summaryrefslogtreecommitdiff
path: root/openttd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-08 18:31:54 +0000
committertron <tron@openttd.org>2006-06-08 18:31:54 +0000
commit7c1f1d823f059e3e8c8a336b6acb819c0ee5a03c (patch)
tree1721f3f0ea1d8ad323751b7106f968c10d52a3b2 /openttd.c
parentb690e85604ce3f024dab32bf19a23afe992090e7 (diff)
downloadopenttd-7c1f1d823f059e3e8c8a336b6acb819c0ee5a03c.tar.xz
(svn r5171) Get rid of an ungly hack in the load routine, which temporarily turned house and road tiles into void tiles to calculate the closest town
Diffstat (limited to 'openttd.c')
-rw-r--r--openttd.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/openttd.c b/openttd.c
index 0589f84b7..d3f831fca 100644
--- a/openttd.c
+++ b/openttd.c
@@ -1210,22 +1210,22 @@ bool AfterLoadGame(void)
* all about ;) */
if (CheckSavegameVersionOldStyle(6, 1)) {
BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) {
- if (IsTileType(tile, MP_HOUSE)) {
- _m[tile].m4 = _m[tile].m2;
- //XXX magic
- SetTileType(tile, MP_VOID);
- _m[tile].m2 = ClosestTownFromTile(tile,(uint)-1)->index;
- SetTileType(tile, MP_HOUSE);
- } else if (IsTileType(tile, MP_STREET)) {
- //XXX magic
- _m[tile].m4 |= (_m[tile].m2 << 4);
- if (IsTileOwner(tile, OWNER_TOWN)) {
- SetTileType(tile, MP_VOID);
- _m[tile].m2 = ClosestTownFromTile(tile,(uint)-1)->index;
- SetTileType(tile, MP_STREET);
- } else {
- SetTownIndex(tile, 0);
- }
+ switch (GetTileType(tile)) {
+ case MP_HOUSE:
+ _m[tile].m4 = _m[tile].m2;
+ SetTownIndex(tile, CalcClosestTownFromTile(tile, (uint)-1)->index);
+ break;
+
+ case MP_STREET:
+ _m[tile].m4 |= (_m[tile].m2 << 4);
+ if (IsTileOwner(tile, OWNER_TOWN)) {
+ SetTownIndex(tile, CalcClosestTownFromTile(tile, (uint)-1)->index);
+ } else {
+ SetTownIndex(tile, 0);
+ }
+ break;
+
+ default: break;
}
} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
}