summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-05-10 09:38:29 +0000
committercelestar <celestar@openttd.org>2006-05-10 09:38:29 +0000
commit3c81a1f1115d9043ed8b98340a23829238853f03 (patch)
treed6caf2ba4c20e050c7446780a9c4050932cf3973
parent31ce3269a754cc0eacca8d66c1c046c1890a6373 (diff)
downloadopenttd-3c81a1f1115d9043ed8b98340a23829238853f03.tar.xz
(svn r4812) -Fix (FS#161) NTP properly checks for railtypes on non-plain-rail-tiles (Rubidium)
-rw-r--r--pathfind.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pathfind.c b/pathfind.c
index 4e65c3d99..799e23d58 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -699,6 +699,10 @@ start_at:
// We are not driving into the tunnel, or it is an invalid tunnel
continue;
}
+ if (!HASBIT(tpf->railtypes, GetRailType(tile))) {
+ bits = 0;
+ break;
+ }
flotr = FindLengthOfTunnel(tile, direction);
si.cur_length += flotr.length * DIAG_FACTOR;
tile = flotr.tile;
@@ -730,6 +734,12 @@ start_at:
// Check that the tile contains exactly one track
if (bits == 0 || KILL_FIRST_BIT(bits) != 0) break;
+ if ((IsTileType(tile, MP_STREET) && !HASBIT(tpf->railtypes, GetRailTypeCrossing(tile))) ||
+ !HASBIT(tpf->railtypes, GetRailType(tile))) {
+ bits = 0;
+ break;
+ }
+
///////////////////
// If we reach here, the tile has exactly one track.
// tile - index to a tile that is not rail tile, but still straight (with optional signals)