changeset 8682:40efe8e42f8f draft

(svn r12348) -Fix (r7573): NTP skipped junction just after bridge end
author smatz <smatz@openttd.org>
date Fri, 07 Mar 2008 00:47:42 +0000
parents 051357af9f76
children 3a9a502e5093
files src/pathfind.cpp
diffstat 1 files changed, 15 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/pathfind.cpp
+++ b/src/pathfind.cpp
@@ -611,37 +611,22 @@
 		/* If the tile is the entry tile of a tunnel, and we're not going out of the tunnel,
 		 *   need to find the exit of the tunnel. */
 		if (IsTileType(tile, MP_TUNNELBRIDGE)) {
-			if (IsTunnel(tile)) {
-				if (GetTunnelBridgeDirection(tile) != ReverseDiagDir(direction)) {
-					/* We are not just driving out of the tunnel */
-					if (GetTunnelBridgeDirection(tile) != direction ||
-							GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
-						/* We are not driving into the tunnel, or it is an invalid tunnel */
-						continue;
-					}
-					if (!HasBit(tpf->railtypes, GetRailType(tile))) {
-						bits = TRACK_BIT_NONE;
-						break;
-					}
+			if (GetTunnelBridgeDirection(tile) != ReverseDiagDir(direction)) {
+				/* We are not just driving out of the tunnel/bridge */
+				if (GetTunnelBridgeDirection(tile) != direction ||
+						GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
+					/* We are not driving into the tunnel/bridge, or it is an invalid tunnel/bridge */
+					continue;
+				}
+				if (!HasBit(tpf->railtypes, GetRailType(tile))) {
+					bits = TRACK_BIT_NONE;
+					break;
+				}
 
-					TileIndex endtile = GetOtherTunnelEnd(tile);
-					si.cur_length += DIAG_FACTOR * (GetTunnelBridgeLength(tile, endtile) + 1);
-					tile = endtile;
-					/* tile now points to the exit tile of the tunnel */
-				}
-			} else { // IsBridge(tile)
-				TileIndex tile_end;
-				if (GetTunnelBridgeDirection(tile) != ReverseDiagDir(direction)) {
-					/* We are not just leaving the bridge */
-					if (GetTunnelBridgeDirection(tile) != direction ||
-							GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
-						/* Not entering the bridge or not compatible */
-						continue;
-					}
-				}
-				tile_end = GetOtherBridgeEnd(tile);
-				si.cur_length += DIAG_FACTOR * (GetTunnelBridgeLength(tile, tile_end) + 1);
-				tile = tile_end;
+				TileIndex endtile = GetOtherTunnelBridgeEnd(tile);
+				si.cur_length += DIAG_FACTOR * (GetTunnelBridgeLength(tile, endtile) + 1);
+				tile = endtile;
+				/* tile now points to the exit tile of the tunnel/bridge */
 			}
 		}