diff options
Diffstat (limited to 'src/char/int_guild.c')
-rw-r--r-- | src/char/int_guild.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 586b42f55..eb03dd335 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -619,8 +619,15 @@ int guild_nextexp(int level) { } // ギルドスキルがあるか確認 -int guild_checkskill(struct guild *g, int id){ - return g->skill[id-10000].lv; +int guild_checkskill(struct guild *g, int id) { + int idx = id - GD_SKILLBASE; + + + if(idx < 0 || idx >= MAX_GUILDSKILL) + + return 0; + + return g->skill[idx].lv; } // ギルドの情報の再計算 @@ -630,7 +637,7 @@ int guild_calcinfo(struct guild *g) { // スキルIDの設定 for(i = 0; i < MAX_GUILDSKILL; i++) - g->skill[i].id = i + 10000; + g->skill[i].id=i+GD_SKILLBASE; // ギルドレベル if (g->guild_lv <= 0) @@ -649,7 +656,7 @@ int guild_calcinfo(struct guild *g) { g->next_exp = guild_nextexp(g->guild_lv); // メンバ上限(ギルド拡張適用) - g->max_member = 16 + guild_checkskill(g, 10004) * 2; + g->max_member = 16 + guild_checkskill(g, GD_EXTENSION) * 2; // 平均レベルとオンライン人数 g->average_lv = 0; @@ -980,7 +987,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, char *name, struct guild_mem g->max_member = 16; g->average_lv = master->lv; for(i = 0; i < MAX_GUILDSKILL; i++) - g->skill[i].id = i + 10000; + g->skill[i].id=i + GD_SKILLBASE; numdb_insert(guild_db, g->guild_id, g); @@ -1230,9 +1237,9 @@ int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_positi // ギルドスキルアップ要求 int mapif_parse_GuildSkillUp(int fd, int guild_id, int skill_num, int account_id) { struct guild *g = numdb_search(guild_db, guild_id); - int idx = skill_num - 10000; + int idx = skill_num - GD_SKILLBASE; - if (g == NULL || skill_num < 10000) + if (g == NULL || idx < 0 || idx >= MAX_GUILDSKILL) return 0; if (g->skill_point > 0 && g->skill[idx].id > 0 && g->skill[idx].lv < 10) { |