Crash prevention
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6706 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
56005cb610
commit
c243406d9e
@ -11412,14 +11412,14 @@ int run_script(struct script_code *rootscript,int pos,int rid,int oid)
|
||||
// let's run that stuff
|
||||
run_script_main(st);
|
||||
|
||||
if(st){
|
||||
if(st->sleep.tick > 0) {
|
||||
// ƒXƒ^ƒbƒN<C692>î•ñ‚ðsleep_db‚ɕۑ¶
|
||||
unsigned int tick = gettick()+st->sleep.tick;
|
||||
st->sleep.charid = sd ? sd->char_id : 0;
|
||||
st->sleep.timer = add_timer(tick, run_script_timer, st->sleep.charid, (int)st);
|
||||
linkdb_insert(&sleep_db, (void*)st->oid, st);
|
||||
} else {
|
||||
if (st->state != END && sd) {
|
||||
} else if (sd) {
|
||||
// script is not finished, store data in sd.
|
||||
sd->npc_script = st->script;
|
||||
sd->npc_scriptroot = rootscript;
|
||||
@ -11427,6 +11427,7 @@ int run_script(struct script_code *rootscript,int pos,int rid,int oid)
|
||||
sd->stack = st->stack;
|
||||
if (bck_stack) //Get rid of the backup as it can't be restored.
|
||||
script_free_stack (bck_stack);
|
||||
}
|
||||
} else {
|
||||
// and if there was a sd associated - zero vars.
|
||||
if (sd) {
|
||||
@ -11444,7 +11445,6 @@ int run_script(struct script_code *rootscript,int pos,int rid,int oid)
|
||||
//aFree(st);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return st->pos;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user