File diff r25773:457e167f3c9e → r25774:14ee6e7f4ecc
src/saveload/station_sl.cpp
Show inline comments
 
@@ -476,28 +476,25 @@ static const SaveLoad _old_station_desc[
 
	/* Used by newstations for graphic variations */
 
	SLE_CONDVAR(Station, random_bits,                SLE_UINT16,                 SLV_27, SL_MAX_VERSION),
 
	SLE_CONDVAR(Station, waiting_triggers,           SLE_UINT8,                  SLV_27, SL_MAX_VERSION),
 
	SLE_CONDVAR(Station, num_specs,                  SLE_UINT8,                  SLV_27, SL_MAX_VERSION),
 

	
 
	SLE_CONDREFLIST(Station, loading_vehicles,       REF_VEHICLE,                SLV_57, SL_MAX_VERSION),
 

	
 
	SLEG_STRUCTLIST("goods", SlStationGoods),
 
	SLEG_CONDSTRUCTLIST("speclist", SlStationSpecList,                           SLV_27, SL_MAX_VERSION),
 
};
 

	
 
struct STNSChunkHandler : ChunkHandler {
 
	STNSChunkHandler() : ChunkHandler('STNS', CH_READONLY)
 
	{
 
		this->fix_pointers = true;
 
	}
 
	STNSChunkHandler() : ChunkHandler('STNS', CH_READONLY) {}
 

	
 
	void Load() const override
 
	{
 
		const std::vector<SaveLoad> slt = SlCompatTableHeader(_old_station_desc, _old_station_sl_compat);
 

	
 
		_cargo_source_xy = 0;
 
		_cargo_days = 0;
 
		_cargo_feeder_share = 0;
 

	
 
		int index;
 
		while ((index = SlIterateArray()) != -1) {
 
			Station *st = new (index) Station();
 
@@ -650,28 +647,25 @@ public:
 
		SlObject(bst, this->GetDescription());
 
	}
 
};
 

	
 
static const SaveLoad _station_desc[] = {
 
	SLE_SAVEBYTE(BaseStation, facilities),
 
	SLEG_STRUCT("normal", SlStationNormal),
 
	SLEG_STRUCT("waypoint", SlStationWaypoint),
 
	SLEG_CONDSTRUCTLIST("speclist", SlStationSpecList, SLV_27, SL_MAX_VERSION),
 
};
 

	
 
struct STNNChunkHandler : ChunkHandler {
 
	STNNChunkHandler() : ChunkHandler('STNN', CH_TABLE)
 
	{
 
		this->fix_pointers = true;
 
	}
 
	STNNChunkHandler() : ChunkHandler('STNN', CH_TABLE) {}
 

	
 
	void Save() const override
 
	{
 
		SlTableHeader(_station_desc);
 

	
 
		/* Write the stations */
 
		for (BaseStation *st : BaseStation::Iterate()) {
 
			SlSetArrayIndex(st->index);
 
			SlObject(st, _station_desc);
 
		}
 
	}
 

	
 
@@ -696,28 +690,25 @@ struct STNNChunkHandler : ChunkHandler {
 
		/* From SLV_123 we store stations in STNN; before that in STNS. So do not
 
		 * fix pointers when the version is below SLV_123, as that would fix
 
		 * pointers twice: once in STNS chunk and once here. */
 
		if (IsSavegameVersionBefore(SLV_123)) return;
 

	
 
		for (BaseStation *bst : BaseStation::Iterate()) {
 
			SlObject(bst, _station_desc);
 
		}
 
	}
 
};
 

	
 
struct ROADChunkHandler : ChunkHandler {
 
	ROADChunkHandler() : ChunkHandler('ROAD', CH_TABLE)
 
	{
 
		this->fix_pointers = true;
 
	}
 
	ROADChunkHandler() : ChunkHandler('ROAD', CH_TABLE) {}
 

	
 
	void Save() const override
 
	{
 
		SlTableHeader(_roadstop_desc);
 

	
 
		for (RoadStop *rs : RoadStop::Iterate()) {
 
			SlSetArrayIndex(rs->index);
 
			SlObject(rs, _roadstop_desc);
 
		}
 
	}
 

	
 
	void Load() const override