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 () --- industry_cmd.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'industry_cmd.c') diff --git a/industry_cmd.c b/industry_cmd.c index 8fb2c03fc..de8bdffa9 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -854,31 +854,35 @@ void DeleteIndustry(Industry *i) static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6}; -static bool IsBadFarmFieldTile(uint tile) +static bool IsBadFarmFieldTile(TileIndex tile) { - if (IsTileType(tile, MP_CLEAR)) { - byte m5 = _map5[tile] & 0x1C; - if (m5 == 0xC || m5 == 0x10) + switch (TileType(tile)) { + case MP_CLEAR: { + byte m5 = _map5[tile] & 0x1C; + return m5 == 0xC || m5 == 0x10; + } + + case MP_TREES: + return false; + + default: return true; - return false; - } else if (IsTileType(tile, MP_TREES)) { - return false; - } else { - return true; } } -static bool IsBadFarmFieldTile2(uint tile) +static bool IsBadFarmFieldTile2(TileIndex tile) { - if (IsTileType(tile, MP_CLEAR)) { - byte m5 = _map5[tile] & 0x1C; - if (m5 == 0x10) + switch (TileType(tile)) { + case MP_CLEAR: { + byte m5 = _map5[tile] & 0x1C; + return m5 == 0x10; + } + + case MP_TREES: + return false; + + default: return true; - return false; - } else if (IsTileType(tile, MP_TREES)) { - return false; - } else { - return true; } } -- cgit v1.2.3-54-g00ecf