Codechange: Add AssignBit function to assign the value of a single bit (#12934)

* Codechange: Add AssignBit function to assign the value of a single bit

* Codechange: Replace various uses of SB with AssignBit

* Codechange: Replace various uses of SB with a constant with SetBit
This commit is contained in:
Jonathan G Rennison
2024-09-10 08:36:58 -04:00
committed by GitHub
parent 27efa57b7b
commit e477706bf5
18 changed files with 48 additions and 29 deletions
+2 -2
View File
@@ -400,7 +400,7 @@ public:
SwapPackets(&ge);
}
if (IsSavegameVersionBefore(SLV_68)) {
SB(ge.status, GoodsEntry::GES_ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
AssignBit(ge.status, GoodsEntry::GES_ACCEPTANCE, HasBit(_waiting_acceptance, 15));
if (GB(_waiting_acceptance, 0, 12) != 0) {
/* In old versions, enroute_from used 0xFF as INVALID_STATION */
StationID source = (IsSavegameVersionBefore(SLV_7) && _cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
@@ -414,7 +414,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, _cargo_source_xy, _cargo_feeder_share);
ge.cargo.Append(cp, INVALID_STATION);
SB(ge.status, GoodsEntry::GES_RATING, 1, 1);
SetBit(ge.status, GoodsEntry::GES_RATING);
}
}
}