diff options
author | pauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-03-02 05:14:31 +0000 |
---|---|---|
committer | pauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-03-02 05:14:31 +0000 |
commit | 9ddee55cb06790b2d7ddf07666390614c92bc71d (patch) | |
tree | 93b4528b40167b3aeed13ee210e65b5637a3007a /crawl-ref/source/mon-util.cc | |
parent | 26302842887cde2a029061396d4f9a4df9e312ce (diff) | |
download | crawl-ref-9ddee55cb06790b2d7ddf07666390614c92bc71d.tar.gz crawl-ref-9ddee55cb06790b2d7ddf07666390614c92bc71d.zip |
Fix [ 1902141 ] Documentation wrong
- changed number comments on a few enums
- added a few COMPILE_CHECKs so they'll get caught
Other:
- Fix COMPILE_CHECK macro so it doesn't cause a warning in gcc.
- Replace ASSERT(...) with COMPILE_CHECK(...) where possible.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3501 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r-- | crawl-ref/source/mon-util.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 6a85bd55cb..95f0d98b83 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1496,8 +1496,8 @@ static const char *drac_colour_names[] = { std::string draconian_colour_name(monster_type mtype) { - ASSERT(ARRAYSIZE(drac_colour_names) == - MONS_PALE_DRACONIAN - MONS_DRACONIAN); + COMPILE_CHECK(ARRAYSIZE(drac_colour_names) == + MONS_PALE_DRACONIAN - MONS_DRACONIAN, c1); if (mtype < MONS_BLACK_DRACONIAN || mtype > MONS_PALE_DRACONIAN) return "buggy"; return (drac_colour_names[mtype - MONS_BLACK_DRACONIAN]); @@ -1505,8 +1505,8 @@ std::string draconian_colour_name(monster_type mtype) monster_type draconian_colour_by_name(const std::string &name) { - ASSERT(ARRAYSIZE(drac_colour_names) == - MONS_PALE_DRACONIAN - MONS_DRACONIAN); + COMPILE_CHECK(ARRAYSIZE(drac_colour_names) == + MONS_PALE_DRACONIAN - MONS_DRACONIAN, c1); for (unsigned i = 0; i < ARRAYSIZE(drac_colour_names); ++i) if (name == drac_colour_names[i]) return static_cast<monster_type>(i + MONS_BLACK_DRACONIAN); @@ -5201,8 +5201,7 @@ static const char *enchant_names[] = const char *mons_enchantment_name(enchant_type ench) { - ASSERT(NUM_ENCHANTMENTS == - (sizeof(enchant_names) / sizeof(*enchant_names)) - 1); + COMPILE_CHECK(ARRAYSIZE(enchant_names) == NUM_ENCHANTMENTS+1, c1); if (ench > NUM_ENCHANTMENTS) ench = NUM_ENCHANTMENTS; |