From 7124f889e3c585947d594aa38be346bc87c08069 Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 26 Jan 2009 04:43:58 +0000 Subject: Simplify checks for grids containing water. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8763 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/terrain.cc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'crawl-ref/source/terrain.cc') diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index 4b3019835a..84d1a2ec1a 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -165,17 +165,17 @@ command_type grid_stair_direction(dungeon_feature_type grid) } } -bool grid_is_opaque( dungeon_feature_type grid ) +bool grid_is_opaque(dungeon_feature_type grid) { return (grid < DNGN_MINSEE); } -bool grid_is_solid( dungeon_feature_type grid ) +bool grid_is_solid(dungeon_feature_type grid) { return (grid < DNGN_MINMOVE); } -bool grid_is_solid( int x, int y ) +bool grid_is_solid(int x, int y) { return (grid_is_solid(grd[x][y])); } @@ -211,27 +211,29 @@ bool grid_is_water(dungeon_feature_type grid) return (grid == DNGN_SHALLOW_WATER || grid == DNGN_DEEP_WATER); } -bool grid_is_watery( dungeon_feature_type grid ) +bool grid_is_watery(dungeon_feature_type grid) { return (grid_is_water(grid) || grid == DNGN_FOUNTAIN_BLUE); } -bool grid_destroys_items( dungeon_feature_type grid ) +bool grid_destroys_items(dungeon_feature_type grid) { return (grid == DNGN_LAVA || grid == DNGN_DEEP_WATER); } -// Returns 0 if grid is not an altar, else it returns the GOD_* type. -god_type grid_altar_god( dungeon_feature_type grid ) +// Returns GOD_NO_GOD if grid is not an altar, otherwise returns the +// GOD_* type. +god_type grid_altar_god(dungeon_feature_type grid) { if (grid >= DNGN_ALTAR_FIRST_GOD && grid <= DNGN_ALTAR_LAST_GOD) - return (static_cast( grid - DNGN_ALTAR_FIRST_GOD + 1 )); + return (static_cast(grid - DNGN_ALTAR_FIRST_GOD + 1)); return (GOD_NO_GOD); } -// Returns DNGN_FLOOR for non-gods, otherwise returns the altar for the god. -dungeon_feature_type altar_for_god( god_type god ) +// Returns DNGN_FLOOR for non-gods, otherwise returns the altar for the +// god. +dungeon_feature_type altar_for_god(god_type god) { if (god == GOD_NO_GOD || god >= NUM_GODS) return (DNGN_FLOOR); // Yeah, lame. Tell me about it. @@ -1058,7 +1060,7 @@ std::string grid_preposition(dungeon_feature_type grid, bool active, else return "inside"; } - else if (!airborne && grid >= DNGN_LAVA && grid <= DNGN_WATER_STUCK) + else if (!airborne && grid_can_be_drowned_in(grid)) { if (active) return "around"; -- cgit v1.2.3-54-g00ecf