Changeset - r23729:25d4f6828003
[Not reviewed]
master
0 1 0
Niels Martin Hansen - 5 years ago 2019-03-23 10:17:27
nielsm@indvikleren.dk
Fix #7371: Avoid dependency on foundations of town tile during saveload
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/viewport.cpp
Show inline comments
 
@@ -2183,7 +2183,9 @@ ViewportSignKdtreeItem ViewportSignKdtre
 
	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;
 

	
0 comments (0 inline, 0 general)