summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-31 21:57:05 +0000
committertron <tron@openttd.org>2005-01-31 21:57:05 +0000
commitaa592190dc3d46b006ce8419e65ba24226e0f313 (patch)
treeee1312aaab150b647a4a1558349f0075f9739142
parentaf3605705f8920d86c021849a50af14a3a322b17 (diff)
downloadopenttd-aa592190dc3d46b006ce8419e65ba24226e0f313.tar.xz
(svn r1756) Cleanup: if cascade -> switch, uint -> TileIndex
-rw-r--r--town_cmd.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/town_cmd.c b/town_cmd.c
index 5a6839d2a..eb6f5eaa6 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -1392,7 +1392,7 @@ int32 CmdRenameTown(int x, int y, uint32 flags, uint32 p1, uint32 p2)
void DeleteTown(Town *t)
{
Industry *i;
- uint tile;
+ TileIndex tile;
// Delete town authority window
// and remove from list of sorted towns
@@ -1406,18 +1406,24 @@ void DeleteTown(Town *t)
}
// Go through all tiles and delete those belonging to the town
- tile = 0;
- do {
- if (IsTileType(tile, MP_HOUSE)) {
- if (ClosestTownFromTile(tile, (uint)-1) == t) {
- DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
- }
- } else if (IsTileType(tile, MP_TUNNELBRIDGE) || IsTileType(tile, MP_STREET)) {
- if (_map_owner[tile] == OWNER_TOWN && ClosestTownFromTile(tile, (uint)-1) == t) {
- DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
- }
+ for (tile = 0; tile < MapSize(); ++tile) {
+ switch (GetTileType(tile)) {
+ case MP_HOUSE:
+ if (ClosestTownFromTile(tile, (uint)-1) == t)
+ DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
+ break;
+
+ case MP_STREET:
+ case MP_TUNNELBRIDGE:
+ if (_map_owner[tile] == OWNER_TOWN &&
+ ClosestTownFromTile(tile, (uint)-1) == t)
+ DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
+ break;
+
+ default:
+ break;
}
- } while (++tile != MapSize());
+ }
t->xy = 0;
DeleteName(t->townnametype);