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/travel.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'crawl-ref/source/travel.cc') diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 6d569f1462..70eb8e867c 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -536,8 +536,10 @@ static bool _is_reseedable(int x, int y) return (true); int grid = grd[x][y]; - return (grid == DNGN_DEEP_WATER || grid == DNGN_SHALLOW_WATER - || grid == DNGN_LAVA || is_trap(x, y) || _is_monster_blocked(x, y)); + return (grid_is_water(grid) + || grid == DNGN_LAVA + || is_trap(x, y) + || _is_monster_blocked(x, y)); } // Returns true if the square at (x,y) is okay to travel over. If ignore_hostile @@ -702,9 +704,9 @@ void initialise_travel() int get_feature_type(const std::string &feature) { if (feature.find("deep water") != std::string::npos) - return DNGN_DEEP_WATER; + return (DNGN_DEEP_WATER); if (feature.find("shallow water") != std::string::npos) - return DNGN_SHALLOW_WATER; + return (DNGN_SHALLOW_WATER); return -1; } @@ -1794,8 +1796,7 @@ bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc) if (dc != start && (feature != DNGN_FLOOR - && feature != DNGN_SHALLOW_WATER - && feature != DNGN_DEEP_WATER + && grid_is_water(feature) && feature != DNGN_LAVA || is_waypoint(dc) || is_stash(ls, dc.x, dc.y))) -- cgit v1.2.3-54-g00ecf