Tracerestrict: Add flag for whether reserve through is always set
This commit is contained in:
@@ -1262,6 +1262,7 @@ bool IsSafeWaitingPosition(const Train *v, TileIndex tile, Trackdir trackdir, bo
|
||||
if (IsRestrictedSignal(ft.m_new_tile)) {
|
||||
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(ft.m_new_tile, TrackdirToTrack(td));
|
||||
if (prog && prog->actions_used_flags & TRPAUF_RESERVE_THROUGH) {
|
||||
if (prog->actions_used_flags & TRPAUF_RESERVE_THROUGH_ALWAYS) return false;
|
||||
TraceRestrictProgramResult out;
|
||||
prog->Execute(v, TraceRestrictProgramInput(ft.m_new_tile, td, &VehiclePosTraceRestrictPreviousSignalCallback, nullptr), out);
|
||||
if (out.flags & TRPRF_RESERVE_THROUGH) {
|
||||
|
@@ -931,6 +931,11 @@ CommandCost TraceRestrictProgram::Validate(const std::vector<TraceRestrictItem>
|
||||
|
||||
case TRIT_RESERVE_THROUGH:
|
||||
actions_used_flags |= TRPAUF_RESERVE_THROUGH;
|
||||
if (GetTraceRestrictValue(item)) {
|
||||
actions_used_flags &= ~TRPAUF_RESERVE_THROUGH_ALWAYS;
|
||||
} else if (condstack.empty()) {
|
||||
actions_used_flags |= TRPAUF_RESERVE_THROUGH_ALWAYS;
|
||||
}
|
||||
break;
|
||||
|
||||
case TRIT_LONG_RESERVE:
|
||||
|
@@ -422,6 +422,7 @@ enum TraceRestrictProgramActionsUsedFlags {
|
||||
TRPAUF_SLOT_ACQUIRE_ON_RES = 1 << 14, ///< Slot acquire (on reserve) action is present
|
||||
TRPAUF_SPEED_ADAPTATION = 1 << 15, ///< Speed adaptation control
|
||||
TRPAUF_PBS_RES_END_SIMULATE = 1 << 16, ///< PBS reservations ending at this signal slot changes must be fully simulated in dry run mode
|
||||
TRPAUF_RESERVE_THROUGH_ALWAYS = 1 << 17, ///< Reserve through action is unconditionally set
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(TraceRestrictProgramActionsUsedFlags)
|
||||
|
||||
|
Reference in New Issue
Block a user