summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tags.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-03 18:34:01 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-03 18:36:53 -0800
commit1bf203aaf578284d268fdca67c9d334a79a53c0d (patch)
treefe95bb3876906713ce7ce33c14e7d3778b53324c /crawl-ref/source/tags.cc
parent20161f77a87bf5ef908369863755304ea011a8bd (diff)
downloadcrawl-ref-1bf203aaf578284d268fdca67c9d334a79a53c0d.tar.gz
crawl-ref-1bf203aaf578284d268fdca67c9d334a79a53c0d.zip
Fixed MONS_NO_MONSTER == NUM_MONSTERS + 1
Fixed MONS_NO_MONSTER == NUM_MONSTERS + 1, which was a problem because MONS_NO_MONSTER can end up in savefiles, meaning that when NUM_MONSTERS increased old save files would become broken. unmarshall_monster() has a temporary hack to preserve compatibility with old save files, and will fail a COMPILE_CHECK() when NUM_MONSTERS increases beyond its current value.
Diffstat (limited to 'crawl-ref/source/tags.cc')
-rw-r--r--crawl-ref/source/tags.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 04e6102d32..9300e7329b 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -2217,6 +2217,16 @@ static void unmarshall_monster(reader &th, monsters &m)
m.set_ghost(unmarshallGhost(th, _tag_minor_version));
m.check_speed();
+
+ // XXX: Changed MONS_NO_MONSTER from NUM_MONSTERS + 1 to 1000.
+ // This is a temporary hack, remove when the following compile
+ // time assert fails.
+ COMPILE_CHECK(NUM_MONSTERS == 472, c1);
+
+ if (m.type == (NUM_MONSTERS + 1))
+ m.type = MONS_NO_MONSTER;
+ if (m.base_monster == (NUM_MONSTERS + 1))
+ m.base_monster = MONS_NO_MONSTER;
}
static void tag_read_level_monsters(reader &th, char minorVersion)