summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-09 16:10:44 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-09 16:10:44 +0000
commit76217d3ca250922d3a55ed73a55e22a678afd49f (patch)
treed34707f47d5ae08cafea553c3a5bcab702d87eea /src/map/script.c
parent6bd0769c68ca86c5454a360f46d0facbbc75cfe5 (diff)
downloadhercules-76217d3ca250922d3a55ed73a55e22a678afd49f.tar.gz
hercules-76217d3ca250922d3a55ed73a55e22a678afd49f.tar.bz2
hercules-76217d3ca250922d3a55ed73a55e22a678afd49f.tar.xz
hercules-76217d3ca250922d3a55ed73a55e22a678afd49f.zip
* [Fixed]:
- Execution of sleep/sleep2 more than once will hang the script_state. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7075 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 9e082a61c..a7c9f4b6e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11442,6 +11442,15 @@ int run_script_main(struct script_state *st)
aFree(st);
st = NULL;
return 0;
+ }else{
+ if(st->sleep.tick > 0)
+ { //Delay execution
+ TBL_PC *sd = (TBL_PC *)map_id2bl(st->rid);
+ st->sleep.charid = sd?sd->char_id:0;
+ st->sleep.timer = add_timer(gettick()+st->sleep.tick,
+ run_script_timer, st->sleep.charid, (int)st);
+ linkdb_insert(&sleep_db, (void*)st->oid, st);
+ }
}
return 1;
@@ -11507,15 +11516,9 @@ int run_script(struct script_code *rootscript,int pos,int rid,int oid)
st->sleep.timer = -1;
if(run_script_main(st)){
- if(st->state != END){
+ if (st->state != END){
pos = st->pos;
- if(st->sleep.tick > 0)
- { //Delay execution
- st->sleep.charid = sd?sd->char_id:0;
- st->sleep.timer = add_timer(gettick()+st->sleep.tick,
- run_script_timer, st->sleep.charid, (int)st);
- linkdb_insert(&sleep_db, (void*)st->oid, st);
- } else if (sd) {
+ if(!st->sleep.tick && sd) {
// script is not finished, store data in sd.
sd->npc_script = st->script;
sd->npc_scriptroot = rootscript;