From 9ddee55cb06790b2d7ddf07666390614c92bc71d Mon Sep 17 00:00:00 2001 From: pauldubois Date: Sun, 2 Mar 2008 05:14:31 +0000 Subject: 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 --- crawl-ref/source/acr.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'crawl-ref/source/acr.cc') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 4023971c9a..d3c9e1bf70 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -189,6 +189,8 @@ static void startup_tutorial(); static void read_messages(); #endif +static void compile_time_asserts(); + /* It all starts here. Some initialisations are run first, then straight to new_game and then input. @@ -199,6 +201,7 @@ int old_main( int argc, char *argv[] ) int main( int argc, char *argv[] ) #endif { + compile_time_asserts(); // just to quiet "unused static function" warning // Load in the system environment variables get_system_environment(); @@ -4360,3 +4363,20 @@ static void update_replay_state() if (!is_processing_macro()) repeat_again_rec.clear(); } + + +void compile_time_asserts() +{ + // Check that the numbering comments in enum.h haven't been + // disturbed accidentally. + COMPILE_CHECK(SK_UNARMED_COMBAT == 19 , c1); + COMPILE_CHECK(SK_EVOCATIONS == 39 , c2); + COMPILE_CHECK(SP_MERFOLK == 35 , c3); + COMPILE_CHECK(SPELL_BOLT_OF_MAGMA == 18 , c4); + COMPILE_CHECK(SPELL_POISON_ARROW == 94 , c5); + COMPILE_CHECK(SPELL_SUMMON_MUSHROOMS == 221 , c6); + + //jmf: NEW ASSERTS: we ought to do a *lot* of these + COMPILE_CHECK(NUM_SPELLS < SPELL_NO_SPELL , c7); + COMPILE_CHECK(NUM_JOBS < JOB_UNKNOWN , c8); +} -- cgit v1.2.3-54-g00ecf