Fix: reset roadtype/streetcartype info for non-road bridges

This commit is contained in:
Yexo 2020-05-04 23:58:56 +02:00 committed by Charles Pigott
parent ea895f05eb
commit e0680c9ede
2 changed files with 21 additions and 0 deletions

View File

@ -3119,6 +3119,14 @@ bool AfterLoadGame()
}
}
if (IsSavegameVersionUntil(SLV_ENDING_YEAR)) {
for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) != TRANSPORT_ROAD) {
SetRoadTypes(t, INVALID_ROADTYPE, INVALID_ROADTYPE);
}
}
}
/* Update station docking tiles. */
AfterLoadScanDockingTiles();

View File

@ -769,6 +769,19 @@ static inline bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor = 0
return _sl_version < major || (minor > 0 && _sl_version == major && _sl_minor_version < minor);
}
/**
* Checks whether the savegame is below or at \a major. This should be used to repair data from existing
* savegames which is no longer corrupted in new savegames, but for which otherwise no savegame
* bump is required.
* @param major Major number of the version to check against.
* @return Savegame version is at most the specified version.
*/
static inline bool IsSavegameVersionUntil(SaveLoadVersion major)
{
extern SaveLoadVersion _sl_version;
return _sl_version <= major;
}
/**
* Checks if some version from/to combination falls within the range of the
* active savegame version.