summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-09-18 01:30:36 +0200
committerHaru <haru@dotalux.com>2016-09-18 01:44:06 +0200
commit53dcedee75954229dcd56c2f04e42e725a1a7359 (patch)
tree5c3f13cbc19ed5adce59b5fda0977e5157bce8f7 /src
parentebecc72d189d931d1b5d8269afd0e89c8ac73c3d (diff)
downloadhercules-53dcedee75954229dcd56c2f04e42e725a1a7359.tar.gz
hercules-53dcedee75954229dcd56c2f04e42e725a1a7359.tar.bz2
hercules-53dcedee75954229dcd56c2f04e42e725a1a7359.tar.xz
hercules-53dcedee75954229dcd56c2f04e42e725a1a7359.zip
Restored handling of "all" in npc_removed_list
- The feature was missing/incomplete since the conversion to libconfig - Fixes #1425 Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r--src/map/map.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 5408cfbfa..308aa82cc 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -4128,6 +4128,7 @@ bool map_read_npclist(const char *filename, bool imported)
struct config_setting_t *setting = NULL;
const char *import = NULL;
bool retval = true;
+ bool remove_all = false;
struct DBMap *deleted_npcs;
@@ -4147,10 +4148,13 @@ bool map_read_npclist(const char *filename, bool imported)
if ((scriptname = libconfig->setting_get_string_elem(setting, i)) == NULL || scriptname[0] == '\0')
continue;
- strdb_put(deleted_npcs, scriptname, NULL);
-
- if (imported) // NPC list is empty on the first run, only do this for imported files.
+ if (strcmp(scriptname, "all") == 0) {
+ remove_all = true;
+ npc->clearsrcfile();
+ } else {
+ strdb_put(deleted_npcs, scriptname, NULL);
npc->delsrcfile(scriptname);
+ }
}
}
@@ -4168,7 +4172,7 @@ bool map_read_npclist(const char *filename, bool imported)
if ((scriptname = libconfig->setting_get_string_elem(setting, i)) == NULL || scriptname[0] == '\0')
continue;
- if (strdb_exists(deleted_npcs, scriptname))
+ if (remove_all || strdb_exists(deleted_npcs, scriptname))
continue;
npc->addsrcfile(scriptname);