diff options
author | Adam Borowski <kilobyte@angband.pl> | 2011-11-10 10:44:46 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2011-11-10 10:45:32 +0100 |
commit | a923452d78deb16b35e959518609402f8690fefd (patch) | |
tree | 6a6ac91efc36ada0b1a62df76d98feb338b3f3a3 /crawl-ref/source/l_mons.cc | |
parent | 1566f8ed044f2605080fcc524fb3d33647080586 (diff) | |
download | crawl-ref-a923452d78deb16b35e959518609402f8690fefd.tar.gz crawl-ref-a923452d78deb16b35e959518609402f8690fefd.zip |
Change several array size asserts to static compile checks.
Diffstat (limited to 'crawl-ref/source/l_mons.cc')
-rw-r--r-- | crawl-ref/source/l_mons.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crawl-ref/source/l_mons.cc b/crawl-ref/source/l_mons.cc index c7a7c8fb63..651500cd75 100644 --- a/crawl-ref/source/l_mons.cc +++ b/crawl-ref/source/l_mons.cc @@ -556,7 +556,7 @@ static const char *_monster_behaviour_names[] = { static const char* _behaviour_name(beh_type beh) { - if (0 <= beh && beh < static_cast<int>(ARRAYSZ(_monster_behaviour_names))) + if (0 <= beh && beh < NUM_BEHAVIOURS) return (_monster_behaviour_names[beh]); else return ("invalid"); @@ -564,9 +564,9 @@ static const char* _behaviour_name(beh_type beh) static beh_type behaviour_by_name(const std::string &name) { - ASSERT(ARRAYSZ(_monster_behaviour_names) == NUM_BEHAVIOURS); + COMPILE_CHECK(ARRAYSZ(_monster_behaviour_names) == NUM_BEHAVIOURS); - for (unsigned i = 0; i < ARRAYSZ(_monster_behaviour_names); ++i) + for (unsigned i = 0; i < NUM_BEHAVIOURS; ++i) if (name == _monster_behaviour_names[i]) return static_cast<beh_type>(i); |