mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Tracerestrict: Fix deleting a slot changing the subtype of referencing actions
This commit is contained in:
parent
2e624df58b
commit
fc6e2a3c5f
@ -2895,10 +2895,10 @@ void TraceRestrictRemoveSlotID(TraceRestrictSlotID index)
|
||||
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 || GetTraceRestrictType(item) == TRIT_COND_TRAIN_IN_SLOT) && GetTraceRestrictValue(item) == index) {
|
||||
SetTraceRestrictValueDefault(item, TRVT_SLOT_INDEX); // this updates the instruction in-place
|
||||
SetTraceRestrictValue(item, INVALID_TRACE_RESTRICT_SLOT_ID); // this updates the instruction in-place
|
||||
}
|
||||
if ((GetTraceRestrictType(item) == TRIT_COND_SLOT_OCCUPANCY) && GetTraceRestrictValue(item) == index) {
|
||||
SetTraceRestrictValueDefault(item, TRVT_SLOT_INDEX_INT); // this updates the instruction in-place
|
||||
SetTraceRestrictValue(item, INVALID_TRACE_RESTRICT_SLOT_ID); // this updates the instruction in-place
|
||||
}
|
||||
if (IsTraceRestrictDoubleItem(item)) i++;
|
||||
}
|
||||
@ -3155,7 +3155,7 @@ void TraceRestrictRemoveCounterID(TraceRestrictCounterID index)
|
||||
for (size_t i = 0; i < prog->items.size(); i++) {
|
||||
TraceRestrictItem &item = prog->items[i]; // note this is a reference,
|
||||
if ((GetTraceRestrictType(item) == TRIT_COUNTER || GetTraceRestrictType(item) == TRIT_COND_COUNTER_VALUE) && GetTraceRestrictValue(item) == index) {
|
||||
SetTraceRestrictValueDefault(item, TRVT_COUNTER_INDEX_INT); // this updates the instruction in-place
|
||||
SetTraceRestrictValue(item, INVALID_TRACE_RESTRICT_COUNTER_ID); // this updates the instruction in-place
|
||||
}
|
||||
if (IsTraceRestrictDoubleItem(item)) i++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user