Fix loading of depot unbunch bit from vanilla saves

pull/661/head
Jonathan G Rennison 3 months ago
parent 37e6f36b1f
commit 69ae516353

@ -2160,9 +2160,6 @@ bool AfterLoadGame()
order->SetWaitTimetabled(HasBit(order->GetRawFlags(), 3));
}
OrderDepotActionFlags flags = (OrderDepotActionFlags)(order->GetDepotActionType() >> 1);
if (((flags & (1 << 2)) != 0) && !SlXvIsFeatureMissing(XSLFI_DEPOT_UNBUNCHING)) {
flags ^= (ODATFB_SELL | ODATFB_UNBUNCH); // Unbunch moved from bit 2 to bit 3
}
order->SetDepotActionType(flags);
}
} else if (SlXvIsFeaturePresent(XSLFI_TT_WAIT_IN_DEPOT, 1, 1)) {
@ -2171,6 +2168,17 @@ bool AfterLoadGame()
if (order->IsType(OT_GOTO_DEPOT)) order->SetWaitTimetabled(HasBit(order->GetRawFlags(), 3));
}
}
if (!IsSavegameVersionBefore(SLV_DEPOT_UNBUNCHING)) {
/* Move unbunch depot action from bit 2 to bit 3 */
for (Order *order : Order::Iterate()) {
if (!order->IsType(OT_GOTO_DEPOT)) continue;
OrderDepotActionFlags flags = order->GetDepotActionType();
if ((flags & ODATFB_SELL) != 0) {
flags ^= (ODATFB_SELL | ODATFB_UNBUNCH); // Move unbunch from bit 2 to bit 3 (sell to unbunch)
order->SetDepotActionType(flags);
}
}
}
if (SlXvIsFeaturePresent(XSLFI_JOKERPP, 1, SL_JOKER_1_23)) {
for (Order *order : Order::Iterate()) {

Loading…
Cancel
Save