Tracerestrict: Use combined aux and cond op fields for TRIT_SLOT subtype

This commit is contained in:
Jonathan G Rennison
2024-01-19 21:35:46 +00:00
parent f03a941b50
commit fc51491361
5 changed files with 34 additions and 15 deletions

View File

@@ -72,6 +72,20 @@ static void Load_TRRP()
if (IsTraceRestrictDoubleItem(item)) i++;
}
}
if (SlXvIsFeatureMissing(XSLFI_TRACE_RESTRICT, 17)) {
/* TRIT_SLOT subtype moved from cond op to combined aux and cond op field in version 17.
* Do this for all previous versions to avoid cases where it is unexpectedly present despite the version,
* e.g. in JokerPP and non-SLXI tracerestrict saves.
*/
for (size_t i = 0; i < prog->items.size(); i++) {
TraceRestrictItem &item = prog->items[i]; // note this is a reference
if (GetTraceRestrictType(item) == TRIT_SLOT) {
TraceRestrictSlotSubtypeField subtype = static_cast<TraceRestrictSlotSubtypeField>(GetTraceRestrictCondOp(item));
SetTraceRestrictCombinedAuxCondOpField(item, subtype);
}
if (IsTraceRestrictDoubleItem(item)) i++;
}
}
CommandCost validation_result = prog->Validate();
if (validation_result.Failed()) {
char str[4096];