diff options
author | Haru <haru@dotalux.com> | 2015-10-20 12:31:00 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-10-20 12:31:00 +0200 |
commit | dea96bda4ba64b7bec3738bd5ab93ee435caa717 (patch) | |
tree | 07ceb92b862d83c9ed09aac10510f996e99093f8 /src/map/mob.c | |
parent | 8547f799e5c395edf2f4e838889b7006e4320820 (diff) | |
download | hercules-dea96bda4ba64b7bec3738bd5ab93ee435caa717.tar.gz hercules-dea96bda4ba64b7bec3738bd5ab93ee435caa717.tar.bz2 hercules-dea96bda4ba64b7bec3738bd5ab93ee435caa717.tar.xz hercules-dea96bda4ba64b7bec3738bd5ab93ee435caa717.zip |
Fixed an issue preventing the mob_db2 from being loaded
Follow-up to 3feef93 (thanks to kyeme)
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index a94abbd97..94d68df88 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -4256,19 +4256,13 @@ void mob_readdb(void) { int i; for (i = 0; i < ARRAYLENGTH(filename); ++i) { - if (i > 0) { - if (!exists(filename[i])) { - continue; - } - } - - mob->read_libconfig(filename[i]); + mob->read_libconfig(filename[i], i > 0 ? true : false); } mob->name_constants(); } -int mob_read_libconfig(const char *filename) +int mob_read_libconfig(const char *filename, bool ignore_missing) { config_t mob_db_conf; char filepath[256]; @@ -4279,6 +4273,9 @@ int mob_read_libconfig(const char *filename) nullpo_ret(filename); sprintf(filepath, "%s/%s", map->db_path, filename); + if (ignore_missing && !exists(filepath)) + return 0; + if (libconfig->read_file(&mob_db_conf, filepath) || !(mdb = libconfig->setting_get_member(mob_db_conf.root, "mob_db"))) { ShowError("can't read %s\n", filepath); return -1; |