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
commit3c6c3895cf14996e7c139e40fdb5326679a2aa51 (patch)
treed6caf2ba4c20e050c7446780a9c4050932cf3973
parentd2fc3431a1baef1d7bbdfc02e80a02b5238f2741 (diff)
downloadopenttd-3c6c3895cf14996e7c139e40fdb5326679a2aa51.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)