From 9068ec7dc0e85cd3f7f8f9a11a3b7f06dc24f4f6 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 18 Sep 2016 01:36:17 +0200 Subject: Removed special handling of "clear" in npc->addsrcfile() - Use npc->clearsrcfile() instead. Signed-off-by: Haru --- src/map/map.c | 2 +- src/map/npc.c | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/map/map.c b/src/map/map.c index 308aa82cc..47e22fa9b 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -4212,7 +4212,7 @@ bool map_read_npclist(const char *filename, bool imported) void map_reloadnpc(bool clear) { int i; if (clear) - npc->addsrcfile("clear"); // this will clear the current script list + npc->clearsrcfile(); #ifdef RENEWAL map->read_npclist("npc/re/scripts_main.conf", false); diff --git a/src/map/npc.c b/src/map/npc.c index efc27c258..9791b66a5 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2432,24 +2432,22 @@ void npc_clearsrcfile(void) npc->src_files = NULL; } -/// Adds a npc source file (or removes all) -void npc_addsrcfile(const char* name) +/** + * Adds a npc source file. + * + * @param name The file name to add. + */ +void npc_addsrcfile(const char *name) { struct npc_src_list* file; struct npc_src_list* file_prev = NULL; nullpo_retv(name); - if( strcmpi(name, "clear") == 0 ) - { - npc->clearsrcfile(); - return; - } // prevent multiple insert of source files file = npc->src_files; - while( file != NULL ) - { - if( strcmp(name, file->name) == 0 ) + while (file != NULL) { + if (strcmp(name, file->name) == 0) return;// found the file, no need to insert it again file_prev = file; file = file->next; -- cgit v1.2.3-70-g09d2