diff options
author | Asheraf <acheraf1998@gmail.com> | 2018-05-15 20:18:49 +0000 |
---|---|---|
committer | Asheraf <acheraf1998@gmail.com> | 2018-05-15 21:24:08 +0000 |
commit | 9d159e4215d42dbbd0f1d4c330421b5f27ac28f7 (patch) | |
tree | facf5e4b0d2dad30045c0e77eb38f965a0caa839 | |
parent | 5c9056c183421df41b546dc3031d251ee6c963b5 (diff) | |
download | hercules-9d159e4215d42dbbd0f1d4c330421b5f27ac28f7.tar.gz hercules-9d159e4215d42dbbd0f1d4c330421b5f27ac28f7.tar.bz2 hercules-9d159e4215d42dbbd0f1d4c330421b5f27ac28f7.tar.xz hercules-9d159e4215d42dbbd0f1d4c330421b5f27ac28f7.zip |
fix a wrong iterator used for mob skill db parsing
-rw-r--r-- | src/map/mob.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index c0bf7946d..58afe4587 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -4879,7 +4879,7 @@ bool mob_skill_db_libconfig_sub(struct config_setting_t *it, int n) bool mob_skill_db_libconfig_sub_skill(struct config_setting_t *it, int n, int mob_id) { - int i, j; + int i, j, idx = 0; int i32; int skill_id = 0; int skill_idx = 0; @@ -4910,8 +4910,8 @@ bool mob_skill_db_libconfig_sub_skill(struct config_setting_t *it, int n, int mo memset(&gms, 0, sizeof (struct mob_skill)); ms = &gms; } else { - ARR_FIND(0, MAX_MOBSKILL, i, (ms = &mob->db_data[mob_id]->skill[i])->skill_id == 0); - if (i == MAX_MOBSKILL) { + ARR_FIND(0, MAX_MOBSKILL, idx, (ms = &mob->db_data[mob_id]->skill[idx])->skill_id == 0); + if (idx == MAX_MOBSKILL) { ShowError("mob_skill_db_libconfig_sub_skill: Too many skills for monster %d\n", mob_id); return false; } @@ -5043,7 +5043,7 @@ bool mob_skill_db_libconfig_sub_skill(struct config_setting_t *it, int n, int mo mob->db_data[i]->maxskill = j + 1; } } else { //Skill set on a single mob. - mob->db_data[mob_id]->maxskill = i + 1; + mob->db_data[mob_id]->maxskill = idx + 1; } return true; |