Merge branch 'master' into jgrpp
This commit is contained in:
@@ -1070,19 +1070,19 @@ bool AfterLoadGame()
|
||||
break;
|
||||
|
||||
case STATION_OILRIG: {
|
||||
/* The internal encoding of oil rigs was changed twice.
|
||||
* It was 3 (till 2.2) and later 5 (till 5.1).
|
||||
* DeleteOilRig asserts on the correct type, and
|
||||
* setting it unconditionally does not hurt.
|
||||
*/
|
||||
Station::GetByTile(t)->airport.type = AT_OILRIG;
|
||||
|
||||
/* Very old savegames sometimes have phantom oil rigs, i.e.
|
||||
* an oil rig which got shut down, but not completely removed from
|
||||
* the map
|
||||
*/
|
||||
TileIndex t1 = TILE_ADDXY(t, 0, 1);
|
||||
if (IsTileType(t1, MP_INDUSTRY) &&
|
||||
GetIndustryGfx(t1) == GFX_OILRIG_1) {
|
||||
/* The internal encoding of oil rigs was changed twice.
|
||||
* It was 3 (till 2.2) and later 5 (till 5.1).
|
||||
* Setting it unconditionally does not hurt.
|
||||
*/
|
||||
Station::GetByTile(t)->airport.type = AT_OILRIG;
|
||||
} else {
|
||||
if (!IsTileType(t1, MP_INDUSTRY) || GetIndustryGfx(t1) != GFX_OILRIG_1) {
|
||||
DeleteOilRig(t);
|
||||
}
|
||||
break;
|
||||
@@ -1400,6 +1400,7 @@ bool AfterLoadGame()
|
||||
}
|
||||
} else if (v->z_pos > GetSlopePixelZ(v->x_pos, v->y_pos)) {
|
||||
v->tile = GetNorthernBridgeEnd(v->tile);
|
||||
v->UpdatePosition();
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@@ -2458,7 +2459,7 @@ bool AfterLoadGame()
|
||||
}
|
||||
|
||||
if (remove) {
|
||||
DeleteAnimatedTile(*tile);
|
||||
tile = _animated_tiles.erase(tile);
|
||||
} else {
|
||||
tile++;
|
||||
}
|
||||
@@ -3664,8 +3665,14 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
/* Update station docking tiles. */
|
||||
AfterLoadScanDockingTiles();
|
||||
if (IsSavegameVersionUntil(SLV_ENDING_YEAR) || !SlXvIsFeaturePresent(XSLFI_MULTIPLE_DOCKS, 2) || !SlXvIsFeaturePresent(XSLFI_DOCKING_CACHE_VER, 1)) {
|
||||
/* Update station docking tiles. Was only needed for pre-SLV_MULTITLE_DOCKS
|
||||
* savegames, but a bug in docking tiles touched all savegames between
|
||||
* SLV_MULTITILE_DOCKS and SLV_ENDING_YEAR. */
|
||||
for (Station *st : Station::Iterate()) {
|
||||
if (st->ship_station.tile != INVALID_TILE) UpdateStationDockingTiles(st);
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute station catchment areas. This is needed here in case UpdateStationAcceptance is called below. */
|
||||
Station::RecomputeCatchmentForAll();
|
||||
|
||||
@@ -948,6 +948,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.
|
||||
|
||||
@@ -30,7 +30,6 @@ void FixupTrainLengths();
|
||||
void AfterLoadTemplateVehicles();
|
||||
void AfterLoadStations();
|
||||
void AfterLoadRoadStops();
|
||||
void AfterLoadScanDockingTiles();
|
||||
void ResetLabelMaps();
|
||||
void AfterLoadLabelMaps();
|
||||
void AfterLoadStoryBook();
|
||||
|
||||
@@ -144,19 +144,6 @@ void AfterLoadRoadStops()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re)scan for station docking tiles after loading a savegame.
|
||||
*/
|
||||
void AfterLoadScanDockingTiles()
|
||||
{
|
||||
if (IsSavegameVersionBefore(SLV_MULTITILE_DOCKS) || !SlXvIsFeaturePresent(XSLFI_MULTIPLE_DOCKS, 2) || !SlXvIsFeaturePresent(XSLFI_DOCKING_CACHE_VER, 1)) {
|
||||
/* Scan for docking tiles */
|
||||
for (Station *st : Station::Iterate()) {
|
||||
if (st->ship_station.tile != INVALID_TILE) UpdateStationDockingTiles(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const SaveLoad _roadstop_desc[] = {
|
||||
SLE_VAR(RoadStop, xy, SLE_UINT32),
|
||||
SLE_CONDNULL(1, SL_MIN_VERSION, SLV_45),
|
||||
|
||||
Reference in New Issue
Block a user