Browse Source

Fixed bugreport:6550 @unloadnpcfile now refreshes the hardcoded npc event array (onpckillevent onpcdieevent etc) so that any unloaded references are properly removed.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16697 54d463be-8e91-2dee-dedb-b68131a5f0ec
shennetsind 12 years ago
parent
commit
9aa4228cf6
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/map/npc.c

+ 4 - 0
src/map/npc.c

@@ -3648,12 +3648,16 @@ bool npc_unloadfile( const char* path ) {
 	for( nd = dbi_first(iter); dbi_exists(iter); nd = dbi_next(iter) ) {
 		if( nd->path && strcasecmp(nd->path,path) == 0 ) {
 			found = true;
+			npc_unload_duplicates(nd);/* unload any npcs which could duplicate this but be in a different file */
 			npc_unload(nd, true);
 		}
 	}
 	
 	dbi_destroy(iter);
 	
+	if( found ) /* refresh event cache */
+		npc_read_event_script();
+	
 	return found;
 }
 void do_clear_npc(void) {