diff options
author | tron <tron@openttd.org> | 2006-06-08 18:31:54 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-06-08 18:31:54 +0000 |
commit | 7c1f1d823f059e3e8c8a336b6acb819c0ee5a03c (patch) | |
tree | 1721f3f0ea1d8ad323751b7106f968c10d52a3b2 /openttd.c | |
parent | b690e85604ce3f024dab32bf19a23afe992090e7 (diff) | |
download | openttd-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.c | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -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); } |