summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/npc.c6
1 files changed, 4 insertions, 2 deletions
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;