summaryrefslogtreecommitdiff
path: root/src/water_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/water_map.h')
-rw-r--r--src/water_map.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/water_map.h b/src/water_map.h
index a7f685270..852396e32 100644
--- a/src/water_map.h
+++ b/src/water_map.h
@@ -68,6 +68,7 @@ static inline WaterTileType GetWaterTileType(TileIndex t)
/**
* Get the water class at a tile.
* @param t Water tile to query.
+ * @pre IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT)
* @return Water class at the tile.
*/
static inline WaterClass GetWaterClass(TileIndex t)
@@ -80,6 +81,7 @@ static inline WaterClass GetWaterClass(TileIndex t)
* Set the water class at a tile.
* @param t Water tile to change.
* @param wc New water class.
+ * @pre IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT)
*/
static inline void SetWaterClass(TileIndex t, WaterClass wc)
{
@@ -88,6 +90,17 @@ static inline void SetWaterClass(TileIndex t, WaterClass wc)
}
/**
+ * Tests if the tile was built on water.
+ * @param t the tile to check
+ * @pre IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT)
+ * @return true iff on water
+ */
+static inline bool IsTileOnWater(TileIndex t)
+{
+ return (GetWaterClass(t) != WATER_CLASS_INVALID);
+}
+
+/**
* Is it a plain water tile?
* @param t Water tile to query.
* @return \c true if any type of clear water like ocean, river, or canal.