Codechange: Use EnumBitSet for GoodsEntry status. (#13899)

This commit is contained in:
Peter Nelson
2025-03-26 21:22:33 +00:00
committed by GitHub
parent 5331389765
commit 325f7f9767
10 changed files with 52 additions and 45 deletions

View File

@@ -414,7 +414,7 @@ public:
SwapPackets(&ge);
}
if (IsSavegameVersionBefore(SLV_68)) {
AssignBit(ge.status, GoodsEntry::GES_ACCEPTANCE, HasBit(_waiting_acceptance, 15));
ge.status.Set(GoodsEntry::State::Acceptance, HasBit(_waiting_acceptance, 15));
if (GB(_waiting_acceptance, 0, 12) != 0) {
/* In old versions, enroute_from used 0xFF as StationID::Invalid() */
StationID source = (IsSavegameVersionBefore(SLV_7) && _cargo_source == 0xFF) ? StationID::Invalid() : static_cast<StationID>(_cargo_source);
@@ -428,7 +428,7 @@ public:
/* 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_periods, source, TileIndex{_cargo_source_xy}, _cargo_feeder_share);
ge.GetOrCreateData().cargo.Append(cp, StationID::Invalid());
SetBit(ge.status, GoodsEntry::GES_RATING);
ge.status.Set(GoodsEntry::State::Rating);
}
}
}