From 4a2f7db99b6e110c7ecca26003f8f09b052b3167 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sat, 19 Jan 2008 17:00:54 +0000 Subject: (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. --- src/water_map.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/water_map.h') 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); -- cgit v1.2.3-54-g00ecf