diff options
author | mekolat <mekolat@users.noreply.github.com> | 2016-04-21 10:46:15 -0400 |
---|---|---|
committer | mekolat <mekolat@users.noreply.github.com> | 2016-04-23 15:01:56 -0400 |
commit | cf4007f34bf5feee7903506e1a569f60aec5b795 (patch) | |
tree | 8e5914a7b596ea569eb177a461d9fe48da2faaf2 | |
parent | b19a8149a4400180427cf9acbd1498151ccb22c7 (diff) | |
download | tmwa-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.cpp | 6 |
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; |