diff options
-rw-r--r-- | Changelog-Trunk.txt | 3 | ||||
-rw-r--r-- | src/map/script.c | 19 |
2 files changed, 14 insertions, 8 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 4dac143ab..6b8b978c3 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/06/09
+ * [Fixed]:
+ - Execution of sleep/sleep2 more than once will hang the script_state.
+ [Lance]
* Fixed @mapinfo displaying incorrectly maps with nosave which send you
back to your last savepoint. [Skotlex]
* Moved guild_exp_rate from a mapserver battle config setting to a char
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; |