From 5bfda2252623ad1b118dea23101ed72c1e77b780 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Fri, 17 Feb 2012 18:03:41 +0000 Subject: Fixed bug with official npc idle timer thing, bugreport:5343 git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15598 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/npc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/map/npc.c') diff --git a/src/map/npc.c b/src/map/npc.c index 9a0eaa71f..12fce2ab4 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -214,9 +214,10 @@ struct npc_data* npc_name2id(const char* name) **/ int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t data) { struct map_session_data* sd = NULL; - if( (sd = map_id2sd(id)) == NULL || !sd->npc_id ) + if( (sd = map_id2sd(id)) == NULL || !sd->npc_id ) { + if( sd ) sd->npc_idle_timer = INVALID_TIMER; return 0;//Not logged in anymore OR no longer attached to a npc - + } if( DIFF_TICK(tick,sd->npc_idle_tick) > (SECURE_NPCTIMEOUT*1000) ) { /** * If we still have the NPC script attached, tell it to stop. @@ -227,6 +228,7 @@ int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t dat * This guy's been idle for longer than allowed, close him. **/ clif_scriptclose(sd,sd->npc_id); + sd->npc_idle_timer = INVALID_TIMER; } else //Create a new instance of ourselves to continue sd->npc_idle_timer = add_timer(gettick() + (SECURE_NPCTIMEOUT_INTERVAL*1000),npc_rr_secure_timeout_timer,sd->bl.id,0); return 0; -- cgit v1.2.3-60-g2f50