summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-05-10 02:44:02 +0000
committerInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-05-10 02:44:02 +0000
commit3598cc2dfa92b2408c2baa6cfd7434b8a170e70d (patch)
tree80820ca99d9fa4244f53251c0888d63390267df9
parent6aa0357455a54308aa7d52b3b262002b7f03d478 (diff)
downloadhercules-3598cc2dfa92b2408c2baa6cfd7434b8a170e70d.tar.gz
hercules-3598cc2dfa92b2408c2baa6cfd7434b8a170e70d.tar.bz2
hercules-3598cc2dfa92b2408c2baa6cfd7434b8a170e70d.tar.xz
hercules-3598cc2dfa92b2408c2baa6cfd7434b8a170e70d.zip
* 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
-rw-r--r--src/map/npc.c9
1 files changed, 6 insertions, 3 deletions
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;