From a6fa88b228e6f2d0bb7e0847254108da7b9c6114 Mon Sep 17 00:00:00 2001 From: Lance Date: Wed, 31 May 2006 05:27:49 +0000 Subject: [Fixed]: - Logic errors in run_script git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6875 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/map/script.c b/src/map/script.c index 6aa75d0fa..95b97ac9f 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11467,14 +11467,17 @@ int run_script(struct script_code *rootscript,int pos,int rid,int oid) st->state = RUN; st->script = rootscript; - if (sd && sd->stack) { // if there's a sd and a stack - back it up and restore it if possible. - bck_script = sd->npc_script; - bck_scriptroot = sd->npc_scriptroot; - bck_scriptstate = sd->npc_scriptstate; - bck_stack = sd->stack; - sd->stack = NULL; - bck_npcid = sd->npc_id; - sd->npc_id = st->oid; + if (sd){ + if(sd->stack) { + // if there's a sd and a stack - back it up and restore it if possible. + bck_script = sd->npc_script; + bck_scriptroot = sd->npc_scriptroot; + bck_scriptstate = sd->npc_scriptstate; + bck_stack = sd->stack; + sd->stack = NULL; + bck_npcid = sd->npc_id; + } + sd->npc_id = oid; } } st->pos = pos; -- cgit v1.2.3-70-g09d2