|
|
|
@ -4264,10 +4264,10 @@ static void TryLongReserveChooseTrainTrack(Train *v, TileIndex tile, Trackdir td
|
|
|
|
|
long_reserve = (out.flags & TRPRF_LONG_RESERVE);
|
|
|
|
|
}
|
|
|
|
|
if (!long_reserve) return;
|
|
|
|
|
if (prog != nullptr && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_SLOT_ACQUIRE | TRPAUF_SLOT_ACQUIRE_ON_RES)) {
|
|
|
|
|
if (prog != nullptr && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_SLOT_ACQUIRE)) {
|
|
|
|
|
TraceRestrictProgramResult out;
|
|
|
|
|
TraceRestrictProgramInput input(exit_tile, exit_td, nullptr, nullptr);
|
|
|
|
|
input.permitted_slot_operations = TRPISP_ACQUIRE | TRPISP_ACQUIRE_ON_RES;
|
|
|
|
|
input.permitted_slot_operations = TRPISP_ACQUIRE;
|
|
|
|
|
prog->Execute(v, input, out);
|
|
|
|
|
if (out.flags & TRPRF_WAIT_AT_PBS) {
|
|
|
|
|
return;
|
|
|
|
@ -4373,10 +4373,10 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir,
|
|
|
|
|
if (track != INVALID_TRACK && HasPbsSignalOnTrackdir(tile, TrackEnterdirToTrackdir(track, enterdir)) && !IsNoEntrySignal(tile, track)) {
|
|
|
|
|
if (IsRestrictedSignal(tile) && v->force_proceed != TFP_SIGNAL) {
|
|
|
|
|
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, track);
|
|
|
|
|
if (prog && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_SLOT_ACQUIRE | TRPAUF_SLOT_ACQUIRE_ON_RES | TRPAUF_TRAIN_NOT_STUCK)) {
|
|
|
|
|
if (prog && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_SLOT_ACQUIRE | TRPAUF_TRAIN_NOT_STUCK)) {
|
|
|
|
|
TraceRestrictProgramResult out;
|
|
|
|
|
TraceRestrictProgramInput input(tile, TrackEnterdirToTrackdir(track, enterdir), nullptr, nullptr);
|
|
|
|
|
input.permitted_slot_operations = TRPISP_ACQUIRE | TRPISP_ACQUIRE_ON_RES;
|
|
|
|
|
input.permitted_slot_operations = TRPISP_ACQUIRE;
|
|
|
|
|
prog->Execute(v, input, out);
|
|
|
|
|
if (out.flags & TRPRF_TRAIN_NOT_STUCK && !(v->track & TRACK_BIT_WORMHOLE) && !(v->track == TRACK_BIT_DEPOT)) {
|
|
|
|
|
v->wait_counter = 0;
|
|
|
|
@ -5245,10 +5245,10 @@ static bool CheckTrainStayInWormHolePathReserve(Train *t, TileIndex tile)
|
|
|
|
|
auto try_exit_reservation = [&]() -> bool {
|
|
|
|
|
if (IsTunnelBridgeRestrictedSignal(tile)) {
|
|
|
|
|
const TraceRestrictProgram *prog = GetExistingTraceRestrictProgram(tile, TrackdirToTrack(td));
|
|
|
|
|
if (prog && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_SLOT_ACQUIRE | TRPAUF_SLOT_ACQUIRE_ON_RES)) {
|
|
|
|
|
if (prog && prog->actions_used_flags & (TRPAUF_WAIT_AT_PBS | TRPAUF_SLOT_ACQUIRE)) {
|
|
|
|
|
TraceRestrictProgramResult out;
|
|
|
|
|
TraceRestrictProgramInput input(tile, td, nullptr, nullptr);
|
|
|
|
|
input.permitted_slot_operations = TRPISP_ACQUIRE | TRPISP_ACQUIRE_ON_RES;
|
|
|
|
|
input.permitted_slot_operations = TRPISP_ACQUIRE;
|
|
|
|
|
prog->Execute(t, input, out);
|
|
|
|
|
if (out.flags & TRPRF_WAIT_AT_PBS) {
|
|
|
|
|
return false;
|
|
|
|
|