summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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