summaryrefslogtreecommitdiff
path: root/industry_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-17 09:41:46 +0000
committertron <tron@openttd.org>2005-01-17 09:41:46 +0000
commitfb0c3c8061ef1320fee319756dc4a7e5f58090f1 (patch)
tree8dc229efa596b250b79a49c52e25faeaf55adc18 /industry_cmd.c
parentd4beff7954f1f016ed517b6c54e6a25895f5481d (diff)
downloadopenttd-fb0c3c8061ef1320fee319756dc4a7e5f58090f1.tar.xz
(svn r1549) Clean up some functions:
uint tile -> TileIndex tile if () cascade -> switch ()
Diffstat (limited to 'industry_cmd.c')
-rw-r--r--industry_cmd.c40
1 files changed, 22 insertions, 18 deletions
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;
}
}