summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tags.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-26 08:18:36 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-26 08:18:36 +0000
commitf6549233f08e88303afd1a6e4da2e89f3355204a (patch)
tree050b8d25ba6174fee9a467a83f4deb085b4d6270 /crawl-ref/source/tags.cc
parent82092097b5a79e335de7845be7c80114d1d1bb52 (diff)
downloadcrawl-ref-f6549233f08e88303afd1a6e4da2e89f3355204a.tar.gz
crawl-ref-f6549233f08e88303afd1a6e4da2e89f3355204a.zip
Reset all of menv in tag_read_level_monsters(). Fixes bug where
sometimes floating monstes would be detected by debug_mons_scan() when going from one level to another, but the problem would be fixed if you saved and restored the game. In tag_read_level_monsters() if DEBUG or DEBUG_MONS_SCAN is defined give an error message if restoring a monster onto a square which already has a monster. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7634 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tags.cc')
-rw-r--r--crawl-ref/source/tags.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index ae13c5c077..2ac7e883f3 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -2149,6 +2149,9 @@ static void tag_read_level_monsters(reader &th, char minorVersion)
int i;
int count, icount;
+ for (i = 0; i < MAX_MONSTERS; i++)
+ menv[i].reset();
+
// how many mons_alloc?
count = unmarshallByte(th);
for (i = 0; i < count; ++i)
@@ -2165,7 +2168,17 @@ static void tag_read_level_monsters(reader &th, char minorVersion)
unmarshall_monster(th, m);
// place monster
if (m.type != -1)
+ {
+#if defined(DEBUG) || defined(DEBUG_MONS_SCAN)
+ int midx = mgrd(m.pos());
+ if (midx != NON_MONSTER)
+ mprf(MSGCH_ERROR, "(%d,%d) for %s already occupied by %s",
+ m.pos().x, m.pos().y,
+ m.name(DESC_PLAIN, true).c_str(),
+ menv[midx].name(DESC_PLAIN, true).c_str());
+#endif
mgrd(m.pos()) = i;
+ }
}
}