summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/debug.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/debug.cc')
-rw-r--r--crawl-ref/source/debug.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 4ce700daa2..731664a7b6 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -1978,8 +1978,48 @@ void debug_item_scan( void )
}
}
}
+
+#endif
+
+#if DEBUG_MONS_SCAN
+void debug_mons_scan()
+{
+ bool warned = false;
+ for (int y = 0; y < GYM; ++y)
+ for (int x = 0; x < GXM; ++x)
+ {
+ const int mons = mgrd[x][y];
+ if (mons != NON_MONSTER &&
+ menv[mons].pos() != coord_def(x, y))
+ {
+ const monsters *m = &menv[mons];
+ mprf(MSGCH_WARN,
+ "Bogosity: mgrd at %d,%d points at %s, "
+ "but monster is at %d,%d",
+ x, y, m->name(DESC_PLAIN).c_str(), m->x, m->y);
+ warned = true;
+ }
+ }
+
+ for (int i = 0; i < MAX_MONSTERS; ++i)
+ {
+ const monsters *m = &menv[i];
+ if (!m->alive())
+ continue;
+ if (mgrd(m->pos()) != i)
+ {
+ mprf(MSGCH_WARN, "Floating monster: %s at (%d,%d)",
+ m->name(DESC_PLAIN).c_str(), m->x, m->y);
+ warned = true;
+ }
+ }
+ // If there are warnings, force the dev to notice. :P
+ if (warned)
+ more();
+}
#endif
+
//---------------------------------------------------------------
//
// debug_item_statistics