From fb0c3c8061ef1320fee319756dc4a7e5f58090f1 Mon Sep 17 00:00:00 2001 From: tron Date: Mon, 17 Jan 2005 09:41:46 +0000 Subject: (svn r1549) Clean up some functions: uint tile -> TileIndex tile if () cascade -> switch () --- water_cmd.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'water_cmd.c') diff --git a/water_cmd.c b/water_cmd.c index e11cc50b9..f3ac23e3a 100644 --- a/water_cmd.c +++ b/water_cmd.c @@ -315,19 +315,27 @@ static int32 ClearTile_Water(uint tile, byte flags) { } // return true if a tile is a water tile. -static bool IsWateredTile(uint tile) +static bool IsWateredTile(TileIndex tile) { byte m5 = _map5[tile]; - if (IsTileType(tile, MP_WATER)) { - return m5 != 1; - } else if (IsTileType(tile, MP_STATION)) { - // returns true if it is a dock-station (m5 inside values is m5<75 all stations, - // 83<=m5<=114 new airports - return !(m5 < 75 || (m5 >= 83 && m5 <= 114)); - } else if (IsTileType(tile, MP_TUNNELBRIDGE)) { - return (m5 & 0xF8) == 0xC8; - } else - return false; + + switch (TileType(tile)) { + case MP_WATER: + // true, if not coast/riverbank + return m5 != 1; + + case MP_STATION: + // returns true if it is a dock-station + // m5 inside values is m5 < 75 all stations, 83 <= m5 <= 114 new airports + return !(m5 < 75 || (m5 >= 83 && m5 <= 114)); + + case MP_TUNNELBRIDGE: + // true, if tile is middle part of bridge with water underneath + return (m5 & 0xF8) == 0xC8; + + default: + return false; + } } // draw a canal styled water tile with dikes around -- cgit v1.2.3-54-g00ecf