summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-05-05 23:52:44 -0400
committermekolat <mekolat@users.noreply.github.com>2015-05-05 23:52:44 -0400
commit2ef763179ebf12ac8834e593f9c5668065e778f7 (patch)
tree2ddb1829086c0161f958ed7b39386d3a89e449e4
parent278c2a8a88966a61a3c41a78c843cf9b6db4af2e (diff)
downloadtmwa-2ef763179ebf12ac8834e593f9c5668065e778f7.tar.gz
tmwa-2ef763179ebf12ac8834e593f9c5668065e778f7.tar.bz2
tmwa-2ef763179ebf12ac8834e593f9c5668065e778f7.tar.xz
tmwa-2ef763179ebf12ac8834e593f9c5668065e778f7.zip
do not allow return outside func or sub
-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 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<ScriptDataRetInfo>()))
+ {
+ dumb_ptr<npc_data> 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))
{ // 戻り値有り