summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-11-13 09:21:03 -0500
committermekolat <mekolat@users.noreply.github.com>2015-11-13 09:21:03 -0500
commit94c0059f64da9f0f2487b50a975214d1e2285a7e (patch)
treeba714c6609f4df07b673272fd3dda93044c4d141 /src
parentc2a722b629b08a2eae726ad4b663616c8d0c4231 (diff)
downloadtmwa-94c0059f64da9f0f2487b50a975214d1e2285a7e.tar.gz
tmwa-94c0059f64da9f0f2487b50a975214d1e2285a7e.tar.bz2
tmwa-94c0059f64da9f0f2487b50a975214d1e2285a7e.tar.xz
tmwa-94c0059f64da9f0f2487b50a975214d1e2285a7e.zip
make crashes more verbose
Diffstat (limited to 'src')
-rw-r--r--src/map/script-call.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/map/script-call.cpp b/src/map/script-call.cpp
index 0c67ba8..54f6c01 100644
--- a/src/map/script-call.cpp
+++ b/src/map/script-call.cpp
@@ -583,9 +583,8 @@ void run_func(ScriptState *st)
start_sp--;
if (start_sp == 0)
{
- if (battle_config.error_log)
- PRINTF("function not found\n"_fmt);
- st->state = ScriptEndState::END;
+ dumb_ptr<npc_data> nd = map_id_is_npc(st->oid);
+ PRINTF("run_func: function not found! @ %s\n"_fmt, nd ? nd->name : NpcName());
abort();
}
}
@@ -597,12 +596,8 @@ void run_func(ScriptState *st)
if (!st->stack->stack_datav[st->start].is<ScriptDataFuncRef>())
{
dumb_ptr<npc_data> nd = map_id_is_npc(st->oid);
- if(nd)
- PRINTF("run_func: not a function or statement! @ %s\n"_fmt, nd->name);
- else
- PRINTF("run_func: not a function or statement! (no npc)\n"_fmt);
-
- st->state = ScriptEndState::END;
+ PRINTF("run_func: not a function or statement! @ %s\n"_fmt,
+ nd ? nd->name : NpcName());
abort();
}
size_t func = st->stack->stack_datav[st->start].get_if<ScriptDataFuncRef>()->numi;
@@ -670,8 +665,9 @@ void run_func(ScriptState *st)
if (st->defsp < 4
|| !st->stack->stack_datav[st->defsp - 1].is<ScriptDataRetInfo>())
{
- PRINTF("script:run_func (return) return without callfunc or callsub!\n"_fmt);
- st->state = ScriptEndState::END;
+ dumb_ptr<npc_data> nd = map_id_is_npc(st->oid);
+ PRINTF("run_func: return without callfunc or callsub! @ %s\n"_fmt,
+ nd ? nd->name : NpcName());
abort();
}
assert (olddefsp == st->defsp); // pretty sure it hasn't changed yet
@@ -766,8 +762,9 @@ void run_script_main(ScriptState *st, Borrowed<const ScriptBuffer> rootscript)
st->state = ScriptEndState::ZERO;
if (st->freeloop != 1 && gotocount > 0 && (--gotocount) <= 0)
{
- PRINTF("run_script: infinity loop !\n"_fmt);
- st->state = ScriptEndState::END;
+ dumb_ptr<npc_data> nd = map_id_is_npc(st->oid);
+ PRINTF("run_script: infinity loop! @ %s\n"_fmt,
+ nd ? nd->name : NpcName());
abort();
}
}
@@ -824,12 +821,12 @@ void run_script_main(ScriptState *st, Borrowed<const ScriptBuffer> rootscript)
}
}
abort();
- break;
}
if (st->freeloop != 1 && cmdcount > 0 && (--cmdcount) <= 0)
{
- PRINTF("run_script: infinity loop !\n"_fmt);
- st->state = ScriptEndState::END;
+ dumb_ptr<npc_data> nd = map_id_is_npc(st->oid);
+ PRINTF("run_script: infinity loop! @ %s\n"_fmt,
+ nd ? nd->name : NpcName());
abort();
}
}