diff options
author | celestar <celestar@openttd.org> | 2005-02-02 14:17:13 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2005-02-02 14:17:13 +0000 |
commit | 30a328705e4428234fff27485c45cef47be95b03 (patch) | |
tree | 712a2b32c2765cf02d1eda5afe810c4c73151cb1 /ttd.c | |
parent | 03095f85bc2d8100e1c4b496dd563f2456c782e6 (diff) | |
download | openttd-30a328705e4428234fff27485c45cef47be95b03.tar.xz |
(svn r1768) -Codechange: Store town index in _map2 of town tiles
Moved house type from _map2 to _map3_hi for MP_HOUSE
Moved foundation and roadworks from _map2 to _map3 for
MP_STREET
This increases game speed by a factor of around 15(!) if many cities are around.
Converting an old game is done automagically, but can take a while
Diffstat (limited to 'ttd.c')
-rw-r--r-- | ttd.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -1407,6 +1407,27 @@ bool AfterLoadGame(uint version) UpdateOilRig(); } + if (version <= 0x600) { + BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) { + if (IsTileType(tile, MP_HOUSE)) { + _map3_hi[tile] = _map2[tile]; + //XXX magic + SetTileType(tile, MP_VOID); + _map2[tile] = ClosestTownFromTile(tile,(uint)-1)->index; + SetTileType(tile, MP_HOUSE); + } else if (IsTileType(tile, MP_STREET)) { + //XXX magic + SetTileType(tile, MP_VOID); + _map3_hi[tile] |= (_map2[tile] << 4); + if ( _map_owner[tile] == OWNER_TOWN) + _map2[tile] = ClosestTownFromTile(tile,(uint)-1)->index; + else + _map2[tile] = 0; + SetTileType(tile, MP_STREET); + } + } END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0); + } + return true; } |