diff options
author | pauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-03-17 11:40:33 +0000 |
---|---|---|
committer | pauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-03-17 11:40:33 +0000 |
commit | 54945881c3da9d5610da4e29a62c2ab0c788d60b (patch) | |
tree | 7b0d0c29113834437a2d0a96cf73aa65a8b27824 /crawl-ref/source/player.cc | |
parent | eda11ccd07fd9869b193d33490d456a56649b4de (diff) | |
download | crawl-ref-54945881c3da9d5610da4e29a62c2ab0c788d60b.tar.gz crawl-ref-54945881c3da9d5610da4e29a62c2ab0c788d60b.zip |
More fixes so 1916515 doesn't happen again.
Add BRANCH_FIRST_HELL and BRANCH_LAST_HELL and check vs those in player_in_hell()
rather than hard-coding the enums. Whoever did that is naughty; they should have
at least stuck a comment in the branch enum.
Also added some compile-checks in player_in_hell to draw attention in
case the hell branches are touched.
Also added some startup code that verifies the branches[] array (whose name
should be changed to Branches!) is in the same order as the branches enum.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3690 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r-- | crawl-ref/source/player.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 28aa2d51a5..5c59b42fcc 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -372,9 +372,14 @@ bool player_in_branch( int branch ) bool player_in_hell( void ) { + // No real reason except to draw someone's attention here if they + // mess with the branch enum. + COMPILE_CHECK(BRANCH_FIRST_HELL == BRANCH_DIS, a); + COMPILE_CHECK(BRANCH_LAST_HELL == BRANCH_THE_PIT, b); + return (you.level_type == LEVEL_DUNGEON - && (you.where_are_you >= BRANCH_DIS - && you.where_are_you <= BRANCH_THE_PIT) + && ( you.where_are_you >= BRANCH_FIRST_HELL + && you.where_are_you <= BRANCH_LAST_HELL) && you.where_are_you != BRANCH_VESTIBULE_OF_HELL); } |