summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-01-01 15:04:35 +0000
committerpeter1138 <peter1138@openttd.org>2007-01-01 15:04:35 +0000
commit47e2dfb318e1d65d6e8af54b330d78f0f323b9bd (patch)
treeb30237b698f2f5a002acd5ab1dd3c54b2b24b62f
parent91a59bfd97482170445bdc006043160108ec228a (diff)
downloadopenttd-47e2dfb318e1d65d6e8af54b330d78f0f323b9bd.tar.xz
(svn r7718) -Fix (runknown): When pathfinding onto a bridge or tunnel end from
previous tile (but not warping from the opposite end) check the enter direction. This fixes signal setting if a rail ends on the top of a tunnel end.
-rw-r--r--pathfind.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/pathfind.c b/pathfind.c
index c4703026d..81ccc699c 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -301,6 +301,22 @@ static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi
if (IsTileDepotType(tile, TRANSPORT_ROAD) && ReverseDiagDir(GetRoadDepotDirection(tile)) != direction) return;
}
+ /* Check if the new tile is a tunnel or bridge head and that the direction
+ * and transport type match */
+ if (IsTileType(tile, MP_TUNNELBRIDGE)) {
+ if (IsTunnel(tile)) {
+ if (GetTunnelDirection(tile) != direction ||
+ GetTunnelTransportType(tile) != tpf->tracktype) {
+ return;
+ }
+ } else if (IsBridge(tile)) {
+ if (GetBridgeRampDirection(tile) != direction ||
+ GetBridgeTransportType(tile) != tpf->tracktype) {
+ return;
+ }
+ }
+ }
+
tpf->rd.cur_length++;
bits = GetTileTrackStatus(tile, tpf->tracktype);