summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-06-06 00:59:30 +0000
committerInkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-06-06 00:59:30 +0000
commit1e0d131e8ab96e066af5fa6f01a5e67f63043b73 (patch)
tree374e2fd857fcb2ae46cde69d3df759342a08063e /src/map
parent23f4078f470deaf16cbadf73efd924c032680da2 (diff)
downloadhercules-1e0d131e8ab96e066af5fa6f01a5e67f63043b73.tar.gz
hercules-1e0d131e8ab96e066af5fa6f01a5e67f63043b73.tar.bz2
hercules-1e0d131e8ab96e066af5fa6f01a5e67f63043b73.tar.xz
hercules-1e0d131e8ab96e066af5fa6f01a5e67f63043b73.zip
Fixed a crash due to script's backup state not being stored/restored properly. (follow up to r13846)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13850 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 913682c89..f09b24a5c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3202,18 +3202,18 @@ void run_script_main(struct script_state *st)
}
if(st->sleep.tick > 0) {
- //Delay execution
- sd = map_id2sd(st->rid); // Refresh sd since script might have attached someone while running. [Inkfish]
- st->sleep.charid = sd?sd->status.char_id:0;
- st->sleep.timer = add_timer(gettick()+st->sleep.tick,
- run_script_timer, st->sleep.charid, (intptr)st);
- linkdb_insert(&sleep_db, (void*)st->oid, st);
//Restore previous script
if (sd) {
sd->st = bk_st;
sd->npc_id = bk_npcid;
bk_st = NULL; //Remove tag for removal.
}
+ //Delay execution
+ sd = map_id2sd(st->rid); // Refresh sd since script might have attached someone while running. [Inkfish]
+ st->sleep.charid = sd?sd->status.char_id:0;
+ st->sleep.timer = add_timer(gettick()+st->sleep.tick,
+ run_script_timer, st->sleep.charid, (intptr)st);
+ linkdb_insert(&sleep_db, (void*)st->oid, st);
}
else if(st->state != END && sd){
//Resume later (st is already attached to player).