瀏覽代碼

* Now if an NPC is unloaded, only the timer of the player attached to this npc will be deleted.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13747 54d463be-8e91-2dee-dedb-b68131a5f0ec
Inkfish 16 年之前
父節點
當前提交
b6f136a75d
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      src/map/npc.c

+ 6 - 3
src/map/npc.c

@@ -1458,9 +1458,12 @@ int npc_unload(struct npc_data* nd)
 			struct map_session_data *sd = map_id2sd(bl->id);
 			if( sd && sd->npc_timer_id != INVALID_TIMER )
 			{
-				const struct TimerData *td = NULL;
-				td = get_timer(sd->npc_timer_id);
-				if (td && td->data) 
+				const struct TimerData *td = get_timer(sd->npc_timer_id);
+
+				if( td && td->id == nd->bl.id )
+					continue;
+
+				if( td && td->data )
 					ers_free(timer_event_ers, (void*)td->data);
 				delete_timer(sd->npc_timer_id, npc_timerevent);
 				sd->npc_timer_id = INVALID_TIMER;