summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/terrain.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-26 04:43:58 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-26 04:43:58 +0000
commit7124f889e3c585947d594aa38be346bc87c08069 (patch)
tree40f1109c243083f31c69f4cd4f545a638833c194 /crawl-ref/source/terrain.cc
parent8921c5b2703c3aa590026bbc8052ba129b6fc02c (diff)
downloadcrawl-ref-7124f889e3c585947d594aa38be346bc87c08069.tar.gz
crawl-ref-7124f889e3c585947d594aa38be346bc87c08069.zip
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
Diffstat (limited to 'crawl-ref/source/terrain.cc')
-rw-r--r--crawl-ref/source/terrain.cc24
1 files changed, 13 insertions, 11 deletions
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<god_type>( grid - DNGN_ALTAR_FIRST_GOD + 1 ));
+ return (static_cast<god_type>(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";