diff options
author | Wushin <pasekei@gmail.com> | 2015-05-06 13:03:13 -0500 |
---|---|---|
committer | Wushin <pasekei@gmail.com> | 2015-05-06 13:03:13 -0500 |
commit | 784ca0b6ec91ecd66019ea915e897ecca4adbed0 (patch) | |
tree | 21d4ab52c95adae3e96d74c13e622976692ee854 /src/map/script-call.cpp | |
parent | 80d274fb48eafda9881bcdacf84a3b76599b2a60 (diff) | |
parent | 2ef763179ebf12ac8834e593f9c5668065e778f7 (diff) | |
download | tmwa-784ca0b6ec91ecd66019ea915e897ecca4adbed0.tar.gz tmwa-784ca0b6ec91ecd66019ea915e897ecca4adbed0.tar.bz2 tmwa-784ca0b6ec91ecd66019ea915e897ecca4adbed0.tar.xz tmwa-784ca0b6ec91ecd66019ea915e897ecca4adbed0.zip |
Merge pull request #71 from mekolat/error
make the script engine scricter
Diffstat (limited to 'src/map/script-call.cpp')
-rw-r--r-- | src/map/script-call.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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<ScriptDataFuncRef>()->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<const ScriptBuffer> 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<const ScriptBuffer> 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) |