From 8c477604eb09028b2dca78b45eb4ffcc8aa10c19 Mon Sep 17 00:00:00 2001 From: michi_cc Date: Sun, 14 Mar 2010 20:57:23 +0000 Subject: [PATCH] (svn r19425) -Fix: [YAPP] A train on a bridge/tunnel was not always found when checking for trains on a reserved path. --- src/pbs.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pbs.cpp b/src/pbs.cpp index e7834ef809..e3b8fa9619 100644 --- a/src/pbs.cpp +++ b/src/pbs.cpp @@ -287,6 +287,11 @@ PBSTileInfo FollowTrainReservation(const Train *v, Vehicle **train_on_res) if (ftoti.best != NULL) *train_on_res = ftoti.best->First(); } } + if (*train_on_res == NULL && IsTileType(ftoti.res.tile, MP_TUNNELBRIDGE)) { + /* The target tile is a bridge/tunnel, also check the other end tile. */ + FindVehicleOnPos(GetOtherTunnelBridgeEnd(ftoti.res.tile), &ftoti, FindTrainOnTrackEnum); + if (ftoti.best != NULL) *train_on_res = ftoti.best->First(); + } } return ftoti.res; }