From 53dcedee75954229dcd56c2f04e42e725a1a7359 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 18 Sep 2016 01:30:36 +0200 Subject: Restored handling of "all" in npc_removed_list - The feature was missing/incomplete since the conversion to libconfig - Fixes #1425 Signed-off-by: Haru --- src/map/map.c | 12 ++++++++---- 1 file 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); -- cgit v1.2.3-60-g2f50