From 3598cc2dfa92b2408c2baa6cfd7434b8a170e70d Mon Sep 17 00:00:00 2001 From: Inkfish Date: Sun, 10 May 2009 02:44:02 +0000 Subject: * Now if an NPC is unloaded, only the timer of the player attached to this npc will be deleted. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13747 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/npc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/map') diff --git a/src/map/npc.c b/src/map/npc.c index f5a1bfc09..d4f0036bb 100644 --- a/src/map/npc.c +++ b/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; -- cgit v1.2.3-60-g2f50