summaryrefslogtreecommitdiff
path: root/src/water_map.h
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-01-19 17:00:54 +0000
committerpeter1138 <peter1138@openttd.org>2008-01-19 17:00:54 +0000
commit4a2f7db99b6e110c7ecca26003f8f09b052b3167 (patch)
tree3ebc439212ad8c6abadb0639fa28e1fda2bb38d8 /src/water_map.h
parentaa0412e0bc379a37f5ac70ac14e56fbf5d427e09 (diff)
downloadopenttd-4a2f7db99b6e110c7ecca26003f8f09b052b3167.tar.xz
(svn r11926) -Feature: Rivers. Graphics must be provided by NewGRF else rivers are drawn as canals. Rivers can currently only be placed with-in the scenario editor.
Diffstat (limited to 'src/water_map.h')
-rw-r--r--src/water_map.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/water_map.h b/src/water_map.h
index c4c131173..98177631b 100644
--- a/src/water_map.h
+++ b/src/water_map.h
@@ -10,6 +10,7 @@ enum WaterTileType {
WATER_TILE_COAST,
WATER_TILE_LOCK,
WATER_TILE_DEPOT,
+ WATER_TILE_RIVER,
};
enum DepotPart {
@@ -31,6 +32,7 @@ static inline WaterTileType GetWaterTileType(TileIndex t)
if (_m[t].m5 == 0) return WATER_TILE_CLEAR;
if (_m[t].m5 == 1) return WATER_TILE_COAST;
+ if (_m[t].m5 == 2) return WATER_TILE_RIVER;
if (IsInsideMM(_m[t].m5, LOCK_MIDDLE, LOCK_END)) return WATER_TILE_LOCK;
assert(IsInsideMM(_m[t].m5, DEPOT_NORTH, DEPOT_END));
@@ -60,6 +62,11 @@ static inline bool IsCanal(TileIndex t)
return GetWaterTileType(t) == WATER_TILE_CLEAR && GetTileOwner(t) != OWNER_WATER;
}
+static inline bool IsRiver(TileIndex t)
+{
+ return GetWaterTileType(t) == WATER_TILE_RIVER;
+}
+
static inline bool IsWaterTile(TileIndex t)
{
return IsTileType(t, MP_WATER) && IsWater(t);
@@ -122,6 +129,16 @@ static inline void MakeShore(TileIndex t)
_m[t].m5 = 1;
}
+static inline void MakeRiver(TileIndex t)
+{
+ SetTileType(t, MP_WATER);
+ SetTileOwner(t, OWNER_WATER);
+ _m[t].m2 = 0;
+ _m[t].m3 = 0;
+ _m[t].m4 = 0;
+ _m[t].m5 = 2;
+}
+
static inline void MakeCanal(TileIndex t, Owner o)
{
assert(o != OWNER_WATER);