summaryrefslogtreecommitdiff
path: root/src/pathfind.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-03-07 00:47:42 +0000
committersmatz <smatz@openttd.org>2008-03-07 00:47:42 +0000
commitd46ac7843838dd622c21bc40f2c2c6ac8c7424cb (patch)
tree367eb5b94dec0b77d38f5b32adab678cdb034c79 /src/pathfind.cpp
parent81174bc523ef1f98158b99cf4f8fa35f0313a3c1 (diff)
downloadopenttd-d46ac7843838dd622c21bc40f2c2c6ac8c7424cb.tar.xz
(svn r12348) -Fix (r7573): NTP skipped junction just after bridge end
Diffstat (limited to 'src/pathfind.cpp')
-rw-r--r--src/pathfind.cpp43
1 files changed, 14 insertions, 29 deletions
diff --git a/src/pathfind.cpp b/src/pathfind.cpp
index 84569bbe0..ea84a76a2 100644
--- a/src/pathfind.cpp
+++ b/src/pathfind.cpp
@@ -611,37 +611,22 @@ start_at:
/* 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;
- }
-
- 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 */
+ 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;
}
- } 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;
- }
+ if (!HasBit(tpf->railtypes, GetRailType(tile))) {
+ bits = TRACK_BIT_NONE;
+ break;
}
- 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 */
}
}