summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-18 03:10:37 +0300
committerGitHub <noreply@github.com>2016-09-18 03:10:37 +0300
commit90c4f0f2087e9895bcca0257fd9500c29d7c1790 (patch)
treed6132f5dcbcc8b5caae346169f9b1e26b76c6405 /src/map/npc.c
parentfc9b897f73fd94afb1ab2c57fe05e9f541136800 (diff)
parent9068ec7dc0e85cd3f7f8f9a11a3b7f06dc24f4f6 (diff)
downloadhercules-90c4f0f2087e9895bcca0257fd9500c29d7c1790.tar.gz
hercules-90c4f0f2087e9895bcca0257fd9500c29d7c1790.tar.bz2
hercules-90c4f0f2087e9895bcca0257fd9500c29d7c1790.tar.xz
hercules-90c4f0f2087e9895bcca0257fd9500c29d7c1790.zip
Merge pull request #1435 from HerculesWS/npc_removed_list
Fixes for npc_removed_list and map_removed
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 36078837f..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;
@@ -2464,24 +2462,21 @@ void npc_addsrcfile(const char* name)
file_prev->next = file;
}
-/// Removes a npc source file (or all)
-void npc_delsrcfile(const char* name)
+/**
+ * Removes a npc source file.
+ *
+ * @param name The file name to remove.
+ */
+void npc_delsrcfile(const char *name)
{
struct npc_src_list* file = npc->src_files;
struct npc_src_list* file_prev = NULL;
nullpo_retv(name);
- if( strcmpi(name, "all") == 0 )
- {
- npc->clearsrcfile();
- return;
- }
- while( file != NULL )
- {
- if( strcmp(file->name, name) == 0 )
- {
- if( npc->src_files == file )
+ while (file != NULL) {
+ if (strcmp(file->name, name) == 0) {
+ if (npc->src_files == file)
npc->src_files = file->next;
else
file_prev->next = file->next;