summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-04-21 10:46:15 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-23 15:01:56 -0400
commitcf4007f34bf5feee7903506e1a569f60aec5b795 (patch)
tree8e5914a7b596ea569eb177a461d9fe48da2faaf2
parentb19a8149a4400180427cf9acbd1498151ccb22c7 (diff)
downloadtmwa-cf4007f34bf5feee7903506e1a569f60aec5b795.tar.gz
tmwa-cf4007f34bf5feee7903506e1a569f60aec5b795.tar.bz2
tmwa-cf4007f34bf5feee7903506e1a569f60aec5b795.tar.xz
tmwa-cf4007f34bf5feee7903506e1a569f60aec5b795.zip
make `get` return -1 when getting a param fails
-rw-r--r--src/map/script-fun.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index beabef3..13a635d 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -3813,7 +3813,10 @@ void builtin_get(ScriptState *st)
}
if (bl == nullptr)
+ {
+ push_int<ScriptDataInt>(st->stack, -1);
return;
+ }
int var = pc_readparam(bl, reg.sp());
push_int<ScriptDataInt>(st->stack, var);
return;
@@ -3869,9 +3872,8 @@ void builtin_get(ScriptState *st)
if (!bl)
{
- PRINTF("builtin_get: no block list attached %s!\n"_fmt, conv_str(st, &AARG(1)));
if (postfix == '$')
- push_str<ScriptDataStr>(st->stack, conv_str(st, &AARG(1)));
+ push_str<ScriptDataStr>(st->stack, ""_s);
else
push_int<ScriptDataInt>(st->stack, 0);
return;