From 1d40bf62ef1180039797d64f9c0aaf5cc639e17e Mon Sep 17 00:00:00 2001 From: mekolat Date: Mon, 27 Apr 2015 22:26:50 -0400 Subject: make script-call stricter --- src/map/script-call.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/map/script-call.cpp b/src/map/script-call.cpp index c3c6aa1..7092dbc 100644 --- a/src/map/script-call.cpp +++ b/src/map/script-call.cpp @@ -28,6 +28,8 @@ #include "../mmo/cxxstdio_enums.hpp" +#include "../high/core.hpp" + #include "battle.hpp" #include "battle_conf.hpp" #include "globals.hpp" @@ -584,6 +586,7 @@ void run_func(ScriptState *st) if (battle_config.error_log) PRINTF("function not found\n"_fmt); st->state = ScriptEndState::END; + runflag = 0; return; } } @@ -596,6 +599,7 @@ void run_func(ScriptState *st) { PRINTF("run_func: not function and command! \n"_fmt); st->state = ScriptEndState::END; + runflag = 0; return; } size_t func = st->stack->stack_datav[st->start].get_if()->numi; @@ -665,6 +669,7 @@ void run_func(ScriptState *st) { PRINTF("script:run_func (return) return without callfunc or callsub!\n"_fmt); st->state = ScriptEndState::END; + runflag = 0; return; } assert (olddefsp == st->defsp); // pretty sure it hasn't changed yet @@ -761,6 +766,7 @@ void run_script_main(ScriptState *st, Borrowed rootscript) { PRINTF("run_script: infinity loop !\n"_fmt); st->state = ScriptEndState::END; + runflag = 0; } } break; @@ -804,12 +810,14 @@ void run_script_main(ScriptState *st, Borrowed rootscript) PRINTF("unknown command : %d @ %zu\n"_fmt, c, st->scriptp.pos); st->state = ScriptEndState::END; + runflag = 0; break; } if (st->freeloop != 1 && cmdcount > 0 && (--cmdcount) <= 0) { PRINTF("run_script: infinity loop !\n"_fmt); st->state = ScriptEndState::END; + runflag = 0; } } switch (st->state) -- cgit v1.2.3-60-g2f50