summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-02-01 11:47:19 -0500
committermekolat <mekolat@users.noreply.github.com>2016-02-01 11:47:19 -0500
commit71c9e0c06045303c5a0a9fb7c849b76583e449c0 (patch)
tree520dc00172873eef36ed984b05a56b29fffbe832 /src
parent66e214e64daa1645e90d1b1e57e2bcea2ec27aa9 (diff)
parent94c0059f64da9f0f2487b50a975214d1e2285a7e (diff)
downloadtmwa-71c9e0c06045303c5a0a9fb7c849b76583e449c0.tar.gz
tmwa-71c9e0c06045303c5a0a9fb7c849b76583e449c0.tar.bz2
tmwa-71c9e0c06045303c5a0a9fb7c849b76583e449c0.tar.xz
tmwa-71c9e0c06045303c5a0a9fb7c849b76583e449c0.zip
Merge pull request #181 from mekolat/verbose-crash
Make crashes more verbose
Diffstat (limited to 'src')
-rw-r--r--src/map/script-call.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/map/script-call.cpp b/src/map/script-call.cpp
index 83b6f24..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();
}
}
@@ -596,8 +595,9 @@ void run_func(ScriptState *st)
if (!st->stack->stack_datav[st->start].is<ScriptDataFuncRef>())
{
- PRINTF("run_func: not function and command! \n"_fmt);
- st->state = ScriptEndState::END;
+ dumb_ptr<npc_data> nd = map_id_is_npc(st->oid);
+ 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;
@@ -665,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
@@ -761,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();
}
}
@@ -819,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();
}
}