Tracerestrict: Add release slot on reserve slot op subtype

This commit is contained in:
Jonathan G Rennison
2024-01-19 22:08:24 +00:00
parent d62ae41e03
commit 876bce431f
4 changed files with 23 additions and 2 deletions

View File

@@ -744,6 +744,14 @@ void TraceRestrictProgram::Execute(const Train* v, const TraceRestrictProgramInp
}
break;
case TRSCOF_RELEASE_ON_RESERVE:
if (input.permitted_slot_operations & TRPISP_ACQUIRE) {
slot->Vacate(v->index);
} else if (input.permitted_slot_operations & TRPISP_ACQUIRE_TEMP_STATE) {
slot->VacateUsingTemporaryState(v->index, input.slot_temporary_state);
}
break;
case TRSCOF_RELEASE_BACK:
if (input.permitted_slot_operations & TRPISP_RELEASE_BACK) slot->Vacate(v->index);
break;
@@ -1357,6 +1365,10 @@ CommandCost TraceRestrictProgram::Validate(const std::vector<TraceRestrictItem>
actions_used_flags |= TRPAUF_SLOT_ACQUIRE;
break;
case TRSCOF_RELEASE_ON_RESERVE:
actions_used_flags |= TRPAUF_SLOT_ACQUIRE;
break;
case TRSCOF_RELEASE_BACK:
actions_used_flags |= TRPAUF_SLOT_RELEASE_BACK;
break;