summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-08-20 11:05:40 -0400
committermekolat <mekolat@users.noreply.github.com>2015-09-26 21:22:02 +0000
commitf71cd5c75c153046074f61987f681529abec75b0 (patch)
tree7c31c8f50c573d0238b95cdfe0e342c20520d513
parentf085c1739a9fafd745492e9c424dd20b1615b7cf (diff)
downloadtmwa-f71cd5c75c153046074f61987f681529abec75b0.tar.gz
tmwa-f71cd5c75c153046074f61987f681529abec75b0.tar.bz2
tmwa-f71cd5c75c153046074f61987f681529abec75b0.tar.xz
tmwa-f71cd5c75c153046074f61987f681529abec75b0.zip
add builtin_if_then_else
-rw-r--r--src/map/script-fun.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 2a50762..6ef05ee 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -486,6 +486,13 @@ void builtin_if (ScriptState *st)
}
static
+void builtin_if_then_else (ScriptState *st)
+{
+ int condition = conv_num(st, &AARG(0));
+ push_copy(st->stack, st->start + (condition ? 3 : 4));
+}
+
+static
void builtin_else (ScriptState *st)
{
int i;
@@ -3317,6 +3324,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(getmap, ""_s, 's'),
BUILTIN(mapexit, ""_s, '\0'),
BUILTIN(freeloop, "i"_s, '\0'),
+ BUILTIN(if_then_else, "iii"_s, '.'),
{nullptr, ""_s, ""_s, '\0'},
};
} // namespace map