Fixed bug with official npc idle timer thing, bugreport:5343

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15598 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
shennetsind 2012-02-17 18:03:41 +00:00
parent 19971714de
commit 6ea41835de

View File

@ -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) { int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data* sd = NULL; 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 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( DIFF_TICK(tick,sd->npc_idle_tick) > (SECURE_NPCTIMEOUT*1000) ) {
/** /**
* If we still have the NPC script attached, tell it to stop. * 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. * This guy's been idle for longer than allowed, close him.
**/ **/
clif_scriptclose(sd,sd->npc_id); clif_scriptclose(sd,sd->npc_id);
sd->npc_idle_timer = INVALID_TIMER;
} else //Create a new instance of ourselves to continue } 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); sd->npc_idle_timer = add_timer(gettick() + (SECURE_NPCTIMEOUT_INTERVAL*1000),npc_rr_secure_timeout_timer,sd->bl.id,0);
return 0; return 0;