mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-11 08:49:50 +00:00
Fix #7371: Avoid dependency on foundations of town tile during saveload
This commit is contained in:
parent
0344e7a0a1
commit
c9fe6e7b8f
@ -2183,7 +2183,9 @@ ViewportSignKdtreeItem ViewportSignKdtreeItem::MakeTown(TownID id)
|
||||
item.id.town = id;
|
||||
|
||||
const Town *town = Town::Get(id);
|
||||
Point pt = RemapCoords2(TileX(town->xy) * TILE_SIZE, TileY(town->xy) * TILE_SIZE);
|
||||
/* Avoid using RemapCoords2, it has dependency on the foundations status of the tile, and that can be unavailable during saveload, leading to crashes.
|
||||
* Instead "fake" foundations by taking the highest Z coordinate of any corner of the tile. */
|
||||
Point pt = RemapCoords(TileX(town->xy) * TILE_SIZE, TileY(town->xy) * TILE_SIZE, GetTileMaxZ(town->xy) * TILE_HEIGHT);
|
||||
|
||||
pt.y -= 24 * ZOOM_LVL_BASE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user