summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-04-27 22:26:50 -0400
committermekolat <mekolat@users.noreply.github.com>2015-05-05 10:18:27 -0400
commit1d40bf62ef1180039797d64f9c0aaf5cc639e17e (patch)
treeba66adf65be29ad902e388e571a44a782e52f2e8 /src/map
parent307c60a8faf7d1e7cb98c9d89a7a737a0267d37a (diff)
downloadtmwa-1d40bf62ef1180039797d64f9c0aaf5cc639e17e.tar.gz
tmwa-1d40bf62ef1180039797d64f9c0aaf5cc639e17e.tar.bz2
tmwa-1d40bf62ef1180039797d64f9c0aaf5cc639e17e.tar.xz
tmwa-1d40bf62ef1180039797d64f9c0aaf5cc639e17e.zip
make script-call stricter
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script-call.cpp8
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)