From f71cd5c75c153046074f61987f681529abec75b0 Mon Sep 17 00:00:00 2001 From: mekolat Date: Thu, 20 Aug 2015 11:05:40 -0400 Subject: add builtin_if_then_else --- src/map/script-fun.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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 @@ -485,6 +485,13 @@ void builtin_if (ScriptState *st) run_func(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) { @@ -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 -- cgit v1.2.3-60-g2f50