From 2ef763179ebf12ac8834e593f9c5668065e778f7 Mon Sep 17 00:00:00 2001 From: mekolat Date: Tue, 5 May 2015 23:52:44 -0400 Subject: do not allow return outside func or sub --- src/map/script-fun.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/map/script-fun.cpp') diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index e619169..6dc1510 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -190,6 +190,14 @@ void builtin_callsub(ScriptState *st) static void builtin_return(ScriptState *st) { + if (!(st->stack->stack_datav[st->defsp - 1].is())) + { + dumb_ptr nd = map_id_is_npc(st->oid); + if(nd) + PRINTF("Deprecated: return outside of callfunc or callsub! @ %s\n"_fmt, nd->name); + else + PRINTF("Deprecated: return outside of callfunc or callsub! (no npc)\n"_fmt); + } #if 0 if (HARG(0)) { // 戻り値有り -- cgit v1.2.3-60-g2f50