diff options
author | shennetsind <ind@henn.et> | 2013-04-16 00:48:09 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-04-16 00:48:09 -0300 |
commit | e671397fb25182e67d191c32f1272a4727322807 (patch) | |
tree | 529f1b3eec363998a7f649564fd33112391f8c47 /src/map/npc.c | |
parent | f3e20da4be387c0e49da58a8be676c9878818ebb (diff) | |
download | hercules-e671397fb25182e67d191c32f1272a4727322807.tar.gz hercules-e671397fb25182e67d191c32f1272a4727322807.tar.bz2 hercules-e671397fb25182e67d191c32f1272a4727322807.tar.xz hercules-e671397fb25182e67d191c32f1272a4727322807.zip |
Fixed Bug #1721
SECURE_NPCTIMEOUT now possesses 3 settings (to mimic official ones)
NPC_SECURE_TIMEOUT_INPUT
NPC_SECURE_TIMEOUT_MENU
NPC_SECURE_TIMEOUT_NEXT
http://hercules.ws/board/tracker/issue-1721-npc-window-timeout/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 5cca94a87..a3340de78 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -240,17 +240,29 @@ struct npc_data* npc_name2id(const char* name) /** * For the Secure NPC Timeout option (check config/Secure.h) [RR] **/ -#if SECURE_NPCTIMEOUT +#ifdef SECURE_NPCTIMEOUT /** * Timer to check for idle time and timeout the dialog if necessary **/ int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t data) { struct map_session_data* sd = NULL; + unsigned int timeout = NPC_SECURE_TIMEOUT_NEXT; 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) ) { + + switch( sd->npc_idle_type ) { + case NPCT_INPUT: + timeout = NPC_SECURE_TIMEOUT_INPUT; + break; + case NPCT_MENU: + timeout = NPC_SECURE_TIMEOUT_MENU; + break; + //case NPCT_WAIT: var starts with this value + } + + if( DIFF_TICK(tick,sd->npc_idle_tick) > (timeout*1000) ) { /** * If we still have the NPC script attached, tell it to stop. **/ @@ -1240,7 +1252,7 @@ int npc_scriptcont(struct map_session_data* sd, int id, bool closing) /** * For the Secure NPC Timeout option (check config/Secure.h) [RR] **/ -#if SECURE_NPCTIMEOUT +#ifdef SECURE_NPCTIMEOUT /** * Update the last NPC iteration **/ |