From 307c60a8faf7d1e7cb98c9d89a7a737a0267d37a Mon Sep 17 00:00:00 2001 From: mekolat Date: Sun, 26 Apr 2015 09:59:54 -0400 Subject: make the script-fun die on errors --- src/map/script-fun.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 142debf..fe46685 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -108,8 +108,9 @@ void builtin_goto(ScriptState *st) { if (!AARG(0).is()) { - PRINTF("script: goto: that's not a label!\n"_fmt); + PRINTF("fatal: script: goto: not label !\n"_fmt); st->state = ScriptEndState::END; + runflag = 0; return; } @@ -149,8 +150,9 @@ void builtin_callfunc(ScriptState *st) } OMATCH_CASE_NONE () { - PRINTF("script: callfunc: function not found! [%s]\n"_fmt, str); + PRINTF("fatal: script: callfunc: function not found! [%s]\n"_fmt, str); st->state = ScriptEndState::END; + runflag = 0; } } OMATCH_END (); @@ -276,7 +278,9 @@ void builtin_menu(ScriptState *st) int arg_index = (sd->npc_menu - 1) * 2 + 1; if (!AARG(arg_index).is()) { + PRINTF("fatal: script:menu: not a label\n"_fmt); st->state = ScriptEndState::END; + runflag = 0; return; } st->scriptp.pos = AARG(arg_index).get_if()->numi; -- cgit v1.2.3-60-g2f50