Codechange: cleanup CargoPacket in terms of variable/function names (#11278)

Over the years, things got reused and changed, making the current
names somewhat unclear in what they actually mean and do.

(cherry picked from commit 30172fc037)
This commit is contained in:
Patric Stout
2023-09-09 23:21:21 +02:00
committed by Jonathan G Rennison
parent 2890127675
commit e5673a1756
27 changed files with 213 additions and 200 deletions

View File

@@ -679,14 +679,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 ),
@@ -706,7 +706,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->CreateData().cargo.Append(new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_days, (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, 0, 0),
ge->CreateData().cargo.Append(new CargoPacket(GB(_waiting_acceptance, 0, 12), _cargo_periods, (_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, 0, 0),
INVALID_STATION);
}
@@ -1172,7 +1172,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 : 0;
v->cargo.Append(new CargoPacket(_cargo_count, _cargo_days, source, source_xy));
v->cargo.Append(new CargoPacket(_cargo_count, _cargo_periods, source, source_xy));
}
}