From 6d30809fc77894e1d2d9e502008dea2156aa4a8b Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 16 Nov 2019 14:52:05 +0000 Subject: [PATCH] Tracerestrict: Add support for signalled tunnel/bridges to PBS entry signal conditional --- src/pathfinder/yapf/yapf_costrail.hpp | 2 ++ src/pbs.cpp | 3 +++ src/tracerestrict_gui.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp index a63166e719..2169429131 100644 --- a/src/pathfinder/yapf/yapf_costrail.hpp +++ b/src/pathfinder/yapf/yapf_costrail.hpp @@ -215,6 +215,8 @@ private: if (IsRailDepotTile(v->tile)) { candidate_tile = v->tile; + } else if (v->track & TRACK_BIT_WORMHOLE && IsTileType(v->tile, MP_TUNNELBRIDGE) && IsTunnelBridgeSignalSimulationExit(v->tile) && IsTunnelBridgePBS(v->tile)) { + candidate_tile = v->tile; } CFollowTrackRail ft(v); diff --git a/src/pbs.cpp b/src/pbs.cpp index b9193d9933..afe27207b3 100644 --- a/src/pbs.cpp +++ b/src/pbs.cpp @@ -448,6 +448,9 @@ TileIndex VehiclePosTraceRestrictPreviousSignalCallback(const Train *v, const vo if (IsRailDepotTile(v->tile)) { return v->tile; } + if (v->track & TRACK_BIT_WORMHOLE && IsTileType(v->tile, MP_TUNNELBRIDGE) && IsTunnelBridgeSignalSimulationExit(v->tile) && IsTunnelBridgePBS(v->tile)) { + return v->tile; + } // scan forwards from vehicle position, for the case that train is waiting at/approaching PBS signal diff --git a/src/tracerestrict_gui.cpp b/src/tracerestrict_gui.cpp index 9ffec662e8..1891443cb8 100644 --- a/src/tracerestrict_gui.cpp +++ b/src/tracerestrict_gui.cpp @@ -1876,6 +1876,8 @@ public: if (IsRailDepotTile(tile)) { // OK + } else if (IsTileType(tile, MP_TUNNELBRIDGE) && IsTunnelBridgeWithSignalSimulation(tile)) { + // OK } else { if (!IsPlainRailTile(tile)) { ShowErrorMessage(error_message, STR_ERROR_THERE_IS_NO_RAILROAD_TRACK, WL_INFO);