summaryrefslogtreecommitdiff
path: root/src/water_map.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-11-21 18:38:45 +0000
committerfrosch <frosch@openttd.org>2010-11-21 18:38:45 +0000
commit612516ff7631f427099c9850941202f2ef33e9ac (patch)
tree77d70b921f516acc12b5e12066fc05ead6c5ee77 /src/water_map.h
parent0fff26db9725b1c0ea414bb246e842375c5a3e31 (diff)
downloadopenttd-612516ff7631f427099c9850941202f2ef33e9ac.tar.xz
(svn r21290) -Codechange: Add HasTileWaterGround() to deduplicate some tests.
Diffstat (limited to 'src/water_map.h')
-rw-r--r--src/water_map.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/water_map.h b/src/water_map.h
index 41a903dd3..f768a7d78 100644
--- a/src/water_map.h
+++ b/src/water_map.h
@@ -284,6 +284,17 @@ static inline byte GetWaterTileRandomBits(TileIndex t)
return _m[t].m4;
}
+/**
+ * Checks whether the tile has water at the ground.
+ * That is, it is either some plain water tile, or a object/industry/station/... with water under it.
+ * @return true iff the tile has water at the ground.
+ * @note Coast tiles are not considered waterish, even if there is water on a halftile.
+ */
+static inline bool HasTileWaterGround(TileIndex t)
+{
+ return HasTileWaterClass(t) && IsTileOnWater(t) && !IsCoastTile(t);
+}
+
/**
* Helper function to make a coast tile.