summaryrefslogtreecommitdiff
path: root/src/pbs.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2010-07-15 19:15:21 +0000
committermichi_cc <michi_cc@openttd.org>2010-07-15 19:15:21 +0000
commit9e93ee3a458747c7d6bc8fff4092e1f25662b534 (patch)
tree87d53ce9b3a96c3a8e41bda756b973eaf6a4cf6a /src/pbs.cpp
parent3ea53ff2fe84c52919447ee25dac33f4ca2bee13 (diff)
downloadopenttd-9e93ee3a458747c7d6bc8fff4092e1f25662b534.tar.xz
(svn r20156) -Fix [FS#3937]: [YAPP] Converting a one-way block to a path signal with trains on both sides could lead to a train crash.
Diffstat (limited to 'src/pbs.cpp')
-rw-r--r--src/pbs.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pbs.cpp b/src/pbs.cpp
index e3b8fa961..dbf7c0d55 100644
--- a/src/pbs.cpp
+++ b/src/pbs.cpp
@@ -314,6 +314,10 @@ Train *GetTrainForReservation(TileIndex tile, Track track)
* have a train on it. We need FollowReservation to ignore one-way signals
* here, as one of the two search directions will be the "wrong" way. */
for (int i = 0; i < 2; ++i, trackdir = ReverseTrackdir(trackdir)) {
+ /* If the tile has a one-way block signal in the current trackdir, skip the
+ * search in this direction as the reservation can't come from this side.*/
+ if (HasOnewaySignalBlockingTrackdir(tile, ReverseTrackdir(trackdir)) && !HasPbsSignalOnTrackdir(tile, trackdir)) continue;
+
FindTrainOnTrackInfo ftoti;
ftoti.res = FollowReservation(GetTileOwner(tile), rts, tile, trackdir, true);