changeset 15504:fd3787b52d77 draft

(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.
author michi_cc <michi_cc@openttd.org>
date Thu, 15 Jul 2010 19:15:21 +0000
parents 1833ab3b0ee4
children dd28864682e7
files src/pbs.cpp
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/pbs.cpp
+++ b/src/pbs.cpp
@@ -314,6 +314,10 @@
 	 * 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);