summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dbg-util.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2011-12-23 13:58:50 -0500
committerNeil Moore <neil@s-z.org>2011-12-23 14:04:10 -0500
commit33745cd6fea71c8eb717ff4603c013a430db47ea (patch)
treeb7aa814357726f0f07506201c7d5937425ea0ec0 /crawl-ref/source/dbg-util.cc
parent827aeca06dc69a30ba5982738b0e2457e542d510 (diff)
downloadcrawl-ref-33745cd6fea71c8eb717ff4603c013a430db47ea.tar.gz
crawl-ref-33745cd6fea71c8eb717ff4603c013a430db47ea.zip
Include monster/player constriction info in crash dumps.
Diffstat (limited to 'crawl-ref/source/dbg-util.cc')
-rw-r--r--crawl-ref/source/dbg-util.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/crawl-ref/source/dbg-util.cc b/crawl-ref/source/dbg-util.cc
index 0742224f48..8cc9602ba9 100644
--- a/crawl-ref/source/dbg-util.cc
+++ b/crawl-ref/source/dbg-util.cc
@@ -123,6 +123,50 @@ std::string debug_mon_str(const monster* mon)
return (out);
}
+void debug_dump_constriction(const actor *act)
+{
+ for(int i_c = 0; i_c < 8; ++i_c)
+ {
+ short constricted = act->constricting[i_c];
+
+ if (constricted != NON_ENTITY)
+ {
+ fprintf(stderr, "Constricting[%d] ", i_c);
+ if (constricted == MHITYOU)
+ {
+ fprintf(stderr, "player %s ",
+ debug_coord_str(you.pos()).c_str());
+ }
+ else if (invalid_monster_index(constricted))
+ fprintf(stderr, "invalid[%hd] ", constricted);
+ else
+ {
+ fprintf(stderr, "%s ",
+ debug_mon_str(&env.mons[constricted]).c_str());
+ }
+
+ fprintf(stderr, "for %d turns\n", act->dur_has_constricted[i_c]);
+ }
+ }
+
+ if (act->constricted_by != NON_ENTITY)
+ {
+ fprintf(stderr, "Constricted by ");
+ if (act->constricted_by == MHITYOU)
+ fprintf(stderr, "player %s ", debug_coord_str(you.pos()).c_str());
+ else if (invalid_monster_index(act->constricted_by))
+ fprintf(stderr, "invalid[%hd] ", act->constricted_by);
+ else
+ {
+ fprintf(stderr, "%s ",
+ debug_mon_str(&env.mons[act->constricted_by]).c_str());
+ }
+
+ fprintf(stderr, "for %d turns (%d escape attempts)\n",
+ act->dur_been_constricted, act->escape_attempts);
+ }
+}
+
void debug_dump_mon(const monster* mon, bool recurse)
{
const int midx = mon->mindex();
@@ -197,6 +241,7 @@ void debug_dump_mon(const monster* mon, bool recurse)
fprintf(stderr, "<OoB>");
fprintf(stderr, "\n");
+ debug_dump_constriction(mon);
if (mon->is_patrolling())
{