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
 
@@ -499,7 +499,12 @@ static Town *RemapTown(TileIndex fallbac
 
{
 
	/* 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;
 
}
 

	
0 comments (0 inline, 0 general)