summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/view.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/view.cc')
-rw-r--r--crawl-ref/source/view.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 67ded0088c..c2fb6f4870 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -1139,6 +1139,23 @@ void monster_grid(bool do_updates)
handle_monster_shouts(monster);
}
+ // [enne] - It's possible that mgrd and monster->x/y are out of
+ // sync because they are updated separately. If we can see this
+ // monster, then make sure that the mgrd is set correctly.
+ if (mgrd[monster->x][monster->y] != s)
+ {
+#ifdef DEBUG_DIAGNOSTICS
+ // If this mprf triggers for you, please note any special
+ // circumstances so we can track down where this is coming
+ // from.
+ mprf(MSGCH_DIAGNOSTICS, "monster (%d) at (%d, %d) was "
+ "improperly placed. Updating mgrd.", s,
+ monster->x, monster->y);
+#endif
+ ASSERT(mgrd[monster->x][monster->y] == NON_MONSTER);
+ mgrd[monster->x][monster->y] = s;
+ }
+
if (!_update_monster_grid(monster))
continue;