Changeset - r28501:0cf4ddc7b995
[Not reviewed]
master
0 1 0
Rubidium - 11 months ago 2024-01-17 21:45:33
rubidium@openttd.org
Fix #11801, 51f1e93: CalcClosestTownFromTile needs the kd-tree to be valid
1 file changed with 6 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/saveload/oldloader_sl.cpp
Show inline comments
 
@@ -496,13 +496,18 @@ static void ClearOldMap3(TileIndex t)
 
}
 

	
 
static Town *RemapTown(TileIndex fallback)
 
{
 
	/* In some cases depots, industries and stations could refer to a missing town. */
 
	Town *t = Town::GetIfValid(RemapTownIndex(_old_town_index));
 
	if (t == nullptr) t = CalcClosestTownFromTile(fallback);
 
	if (t == nullptr) {
 
		/* In case the town that was refered to does not exist, find the closest.
 
		 * However, this needs the kd-tree to be present. */
 
		RebuildTownKdtree();
 
		t = CalcClosestTownFromTile(fallback);
 
	}
 
	return t;
 
}
 

	
 
static void ReadTTDPatchFlags()
 
{
 
	if (_read_ttdpatch_flags) return;
0 comments (0 inline, 0 general)