summaryrefslogtreecommitdiff
path: root/disaster_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 /disaster_cmd.c
parentd4beff7954f1f016ed517b6c54e6a25895f5481d (diff)
downloadopenttd-fb0c3c8061ef1320fee319756dc4a7e5f58090f1.tar.xz
(svn r1549) Clean up some functions:
uint tile -> TileIndex tile if () cascade -> switch ()
Diffstat (limited to 'disaster_cmd.c')
-rw-r--r--disaster_cmd.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/disaster_cmd.c b/disaster_cmd.c
index 0c28ddc0a..16c0a523d 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -13,25 +13,31 @@
#include "airport_movement.h"
#include "sound.h"
-static void DisasterClearSquare(uint tile)
+static void DisasterClearSquare(TileIndex tile)
{
- int type;
-
if (!EnsureNoVehicle(tile))
return;
- type = TileType(tile);
+ switch (TileType(tile)) {
+ case MP_RAILWAY:
+ if (IS_HUMAN_PLAYER(_map_owner[tile])) DoClearSquare(tile);
+ break;
+
+ case MP_HOUSE: {
+ byte p = _current_player;
+ _current_player = OWNER_NONE;
+ DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
+ _current_player = p;
+ break;
+ }
- if (type == MP_RAILWAY) {
- if (IS_HUMAN_PLAYER(_map_owner[tile]))
+ case MP_TREES:
+ case MP_CLEAR:
DoClearSquare(tile);
- } else if (type == MP_HOUSE) {
- byte p = _current_player;
- _current_player = OWNER_NONE;
- DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
- _current_player = p;
- } else if (type == MP_TREES || type == MP_CLEAR) {
- DoClearSquare(tile);
+ break;
+
+ default:
+ break;
}
}