From b4d6890957c2c3e74b49ce3ceb33c1dfafd529da Mon Sep 17 00:00:00 2001
From: skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>
Date: Tue, 14 Mar 2006 19:10:09 +0000
Subject: - Some small cleanups of how @reloadscript works.

git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5600 54d463be-8e91-2dee-dedb-b68131a5f0ec
---
 src/map/atcommand.c | 1 -
 src/map/npc.c       | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)

(limited to 'src/map')

diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 38d335377..44f689c2d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5519,7 +5519,6 @@ int atcommand_reloadscript(
 	//do_init_npc();
 	script_reload();
 	npc_reload();
-	npc_event_do_oninit();
 
 	clif_displaymessage(fd, msg_table[100]); // Scripts reloaded.
 
diff --git a/src/map/npc.c b/src/map/npc.c
index 276d615be..e3abe5eaa 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2800,17 +2800,17 @@ int npc_reload (void)
 	int busy = 0, npc_new_min = npc_id;
 	char c = '-';
 
+	//Remove all npcs/mobs. [Skotlex]
+	map_foreachiddb(npc_cleanup_dbsub);
 	for (m = 0; m < map_num; m++) {
-		map_foreachinmap(npc_cleanup_sub, m, 0);
 		if(battle_config.dynamic_mobs) {	//dynamic check by [random]
 			for (i = 0; i < MAX_MOB_LIST_PER_MAP; i++)
 				if (map[m].moblist[i]) aFree(map[m].moblist[i]);
 			memset (map[m].moblist, 0, sizeof(map[m].moblist));
 		}
-		map[m].npc_num = 0;
+		if (map[m].npc_num > 0 && battle_config.error_log)
+			ShowWarning("npc_reload: %d npcs weren't removed at map %s!\n", map[m].npc_num, map[m].name);
 	}
-	//Remove any npcs/mobs that weren't caught by the previous loop. [Skotlex]
-	map_foreachiddb(npc_cleanup_dbsub);
 
 	// anything else we should cleanup?
 	// Reloading npc's now
-- 
cgit v1.2.3-70-g09d2