Codechange: rename cargo aging days to periods, as they are not really days (#11112)
This commit is contained in:
@@ -92,8 +92,9 @@ SaveLoadTable GetCargoPacketDesc()
|
||||
SLE_VAR(CargoPacket, source_xy, SLE_UINT32),
|
||||
SLE_VAR(CargoPacket, loaded_at_xy, SLE_UINT32),
|
||||
SLE_VAR(CargoPacket, count, SLE_UINT16),
|
||||
SLE_CONDVAR(CargoPacket, days_in_transit, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_MORE_CARGO_AGE),
|
||||
SLE_CONDVAR(CargoPacket, days_in_transit, SLE_UINT16, SLV_MORE_CARGO_AGE, SL_MAX_VERSION),
|
||||
SLE_CONDVARNAME(CargoPacket, periods_in_transit, "days_in_transit", SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_MORE_CARGO_AGE),
|
||||
SLE_CONDVARNAME(CargoPacket, periods_in_transit, "days_in_transit", SLE_UINT16, SLV_MORE_CARGO_AGE, SLV_PERIODS_IN_TRANSIT_RENAME),
|
||||
SLE_CONDVAR(CargoPacket, periods_in_transit, SLE_UINT16, SLV_PERIODS_IN_TRANSIT_RENAME, SL_MAX_VERSION),
|
||||
SLE_VAR(CargoPacket, feeder_share, SLE_INT64),
|
||||
SLE_CONDVAR(CargoPacket, source_type, SLE_UINT8, SLV_125, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(CargoPacket, source_id, SLE_UINT16, SLV_125, SL_MAX_VERSION),
|
||||
|
@@ -683,14 +683,14 @@ static bool LoadOldDepot(LoadgameState *ls, int num)
|
||||
static StationID _current_station_id;
|
||||
static uint16 _waiting_acceptance;
|
||||
static uint8 _cargo_source;
|
||||
static uint8 _cargo_days;
|
||||
static uint8 _cargo_periods;
|
||||
|
||||
static const OldChunks goods_chunk[] = {
|
||||
OCL_VAR ( OC_UINT16, 1, &_waiting_acceptance ),
|
||||
OCL_SVAR( OC_UINT8, GoodsEntry, time_since_pickup ),
|
||||
OCL_SVAR( OC_UINT8, GoodsEntry, rating ),
|
||||
OCL_VAR ( OC_UINT8, 1, &_cargo_source ),
|
||||
OCL_VAR ( OC_UINT8, 1, &_cargo_days ),
|
||||
OCL_VAR ( OC_UINT8, 1, &_cargo_periods ),
|
||||
OCL_SVAR( OC_UINT8, GoodsEntry, last_speed ),
|
||||
OCL_SVAR( OC_UINT8, GoodsEntry, last_age ),
|
||||
|
||||
@@ -710,7 +710,7 @@ static bool LoadOldGood(LoadgameState *ls, int num)
|
||||
SB(ge->status, GoodsEntry::GES_ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
|
||||
SB(ge->status, GoodsEntry::GES_RATING, 1, _cargo_source != 0xFF);
|
||||
if (GB(_waiting_acceptance, 0, 12) != 0 && CargoPacket::CanAllocateItem()) {
|
||||
ge->cargo.Append(new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, 0, 0),
|
||||
ge->cargo.Append(new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_periods, (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, 0, 0),
|
||||
INVALID_STATION);
|
||||
}
|
||||
|
||||
@@ -1175,7 +1175,7 @@ static const OldChunks vehicle_chunk[] = {
|
||||
OCL_VAR ( OC_TTD | OC_UINT16, 1, &_cargo_count ),
|
||||
OCL_VAR ( OC_TTO | OC_FILE_U8 | OC_VAR_U16, 1, &_cargo_count ),
|
||||
OCL_VAR ( OC_UINT8, 1, &_cargo_source ),
|
||||
OCL_VAR ( OC_UINT8, 1, &_cargo_days ),
|
||||
OCL_VAR ( OC_UINT8, 1, &_cargo_periods ),
|
||||
|
||||
OCL_SVAR( OC_TTO | OC_UINT8, Vehicle, tick_counter ),
|
||||
|
||||
@@ -1353,7 +1353,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
|
||||
if (_cargo_count != 0 && CargoPacket::CanAllocateItem()) {
|
||||
StationID source = (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
|
||||
TileIndex source_xy = (source != INVALID_STATION) ? Station::Get(source)->xy : (TileIndex)0;
|
||||
v->cargo.Append(new CargoPacket(_cargo_count, _cargo_days, source, source_xy, source_xy));
|
||||
v->cargo.Append(new CargoPacket(_cargo_count, _cargo_periods, source, source_xy, source_xy));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -357,6 +357,7 @@ enum SaveLoadVersion : uint16 {
|
||||
SLV_STRING_GAMELOG, ///< 314 PR#10801 Use std::string in gamelog.
|
||||
|
||||
SLV_INDUSTRY_CARGO_REORGANISE, ///< 315 PR#10853 Industry accepts/produced data reorganised.
|
||||
SLV_PERIODS_IN_TRANSIT_RENAME, ///< 316 PR#11112 Rename days in transit to (cargo) periods in transit.
|
||||
|
||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||
};
|
||||
|
@@ -162,7 +162,7 @@ static uint16 _waiting_acceptance;
|
||||
static uint32 _old_num_flows;
|
||||
static uint16 _cargo_source;
|
||||
static uint32 _cargo_source_xy;
|
||||
static uint8 _cargo_days;
|
||||
static uint8 _cargo_periods;
|
||||
static Money _cargo_feeder_share;
|
||||
|
||||
std::list<CargoPacket *> _packets;
|
||||
@@ -371,7 +371,7 @@ public:
|
||||
SLEG_CONDVAR("cargo_source", _cargo_source, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_7),
|
||||
SLEG_CONDVAR("cargo_source", _cargo_source, SLE_UINT16, SLV_7, SLV_68),
|
||||
SLEG_CONDVAR("cargo_source_xy", _cargo_source_xy, SLE_UINT32, SLV_44, SLV_68),
|
||||
SLEG_CONDVAR("cargo_days", _cargo_days, SLE_UINT8, SL_MIN_VERSION, SLV_68),
|
||||
SLEG_CONDVAR("cargo_days", _cargo_periods, SLE_UINT8, SL_MIN_VERSION, SLV_68),
|
||||
SLE_VAR(GoodsEntry, last_speed, SLE_UINT8),
|
||||
SLE_VAR(GoodsEntry, last_age, SLE_UINT8),
|
||||
SLEG_CONDVAR("cargo_feeder_share", _cargo_feeder_share, SLE_FILE_U32 | SLE_VAR_I64, SLV_14, SLV_65),
|
||||
@@ -449,7 +449,7 @@ public:
|
||||
assert(CargoPacket::CanAllocateItem());
|
||||
|
||||
/* Don't construct the packet with station here, because that'll fail with old savegames */
|
||||
CargoPacket *cp = new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, source, _cargo_source_xy, _cargo_source_xy, _cargo_feeder_share);
|
||||
CargoPacket *cp = new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_periods, source, _cargo_source_xy, _cargo_source_xy, _cargo_feeder_share);
|
||||
ge->cargo.Append(cp, INVALID_STATION);
|
||||
SB(ge->status, GoodsEntry::GES_RATING, 1, 1);
|
||||
}
|
||||
@@ -529,7 +529,7 @@ struct STNSChunkHandler : ChunkHandler {
|
||||
const std::vector<SaveLoad> slt = SlCompatTableHeader(_old_station_desc, _old_station_sl_compat);
|
||||
|
||||
_cargo_source_xy = 0;
|
||||
_cargo_days = 0;
|
||||
_cargo_periods = 0;
|
||||
_cargo_feeder_share = 0;
|
||||
|
||||
int index;
|
||||
|
@@ -571,7 +571,7 @@ void FixupTrainLengths()
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 _cargo_days;
|
||||
static uint8 _cargo_periods;
|
||||
static uint16 _cargo_source;
|
||||
static uint32 _cargo_source_xy;
|
||||
static uint16 _cargo_count;
|
||||
@@ -628,7 +628,7 @@ public:
|
||||
|
||||
SLE_VAR(Vehicle, cargo_type, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, cargo_subtype, SLE_UINT8, SLV_35, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR("cargo_days", _cargo_days, SLE_UINT8, SL_MIN_VERSION, SLV_68),
|
||||
SLEG_CONDVAR("cargo_days", _cargo_periods, SLE_UINT8, SL_MIN_VERSION, SLV_68),
|
||||
SLEG_CONDVAR("cargo_source", _cargo_source, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_7),
|
||||
SLEG_CONDVAR("cargo_source", _cargo_source, SLE_UINT16, SLV_7, SLV_68),
|
||||
SLEG_CONDVAR("cargo_source_xy", _cargo_source_xy, SLE_UINT32, SLV_44, SLV_68),
|
||||
@@ -1042,7 +1042,7 @@ struct VEHSChunkHandler : ChunkHandler {
|
||||
|
||||
if (_cargo_count != 0 && IsCompanyBuildableVehicleType(v) && CargoPacket::CanAllocateItem()) {
|
||||
/* Don't construct the packet with station here, because that'll fail with old savegames */
|
||||
CargoPacket *cp = new CargoPacket(_cargo_count, _cargo_days, _cargo_source, _cargo_source_xy, _cargo_loaded_at_xy, _cargo_feeder_share);
|
||||
CargoPacket *cp = new CargoPacket(_cargo_count, _cargo_periods, _cargo_source, _cargo_source_xy, _cargo_loaded_at_xy, _cargo_feeder_share);
|
||||
v->cargo.Append(cp);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user