Changeset - r24175:5bb689dc5bab
[Not reviewed]
master
0 3 0
glx - 4 years ago 2020-05-06 20:44:47
glx@openttd.org
Fix #8021: limit savegame range for docking tiles fixing
3 files changed with 8 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/saveload/afterload.cpp
Show inline comments
 
@@ -3117,22 +3117,27 @@ bool AfterLoadGame()
 
				if (IsDock(t) || IsOilRig(t)) Station::GetByTile(t)->ship_station.Add(t);
 
			}
 
		}
 
	}
 

	
 
	if (IsSavegameVersionUntil(SLV_ENDING_YEAR)) {
 
		/* 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);
 
		}
 

	
 
		/* Reset roadtype/streetcartype info for non-road bridges. */
 
		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();
 

	
 
	/* Compute station catchment areas. This is needed here in case UpdateStationAcceptance is called below. */
 
	Station::RecomputeCatchmentForAll();
 

	
 
	/* Station acceptance is some kind of cache */
 
	if (IsSavegameVersionBefore(SLV_127)) {
 
		for (Station *st : Station::Iterate()) UpdateStationAcceptance(st, false);
src/saveload/saveload_internal.h
Show inline comments
 
@@ -26,13 +26,12 @@ void MoveWaypointsToBaseStations();
 
const SaveLoad *GetBaseStationDescription();
 

	
 
void AfterLoadVehicles(bool part_of_load);
 
void FixupTrainLengths();
 
void AfterLoadStations();
 
void AfterLoadRoadStops();
 
void AfterLoadScanDockingTiles();
 
void ResetLabelMaps();
 
void AfterLoadLabelMaps();
 
void AfterLoadStoryBook();
 
void AfterLoadLinkGraphs();
 
void AfterLoadCompanyStats();
 
void UpdateHousesAndTowns();
src/saveload/station_sl.cpp
Show inline comments
 
@@ -138,23 +138,12 @@ void AfterLoadRoadStops()
 

	
 
		rs->GetEntry(DIAGDIR_NE)->Rebuild(rs);
 
		rs->GetEntry(DIAGDIR_NW)->Rebuild(rs);
 
	}
 
}
 

	
 
/**
 
 * (Re)scan for station docking tiles after loading a savegame.
 
 */
 
void AfterLoadScanDockingTiles()
 
{
 
	/* 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),
 
	SLE_VAR(RoadStop, status,       SLE_UINT8),
 
	/* Index was saved in some versions, but this is not needed */
 
	SLE_CONDNULL(4, SL_MIN_VERSION, SLV_9),
0 comments (0 inline, 0 general)