(svn r4812) -Fix (FS#161) NTP properly checks for railtypes on non-plain-rail-tiles (Rubidium)
authorcelestar
Wed, 10 May 2006 09:38:29 +0000
changeset 3804 13ee0f2f5cc9
parent 3803 1bd124196372
child 3805 a50035a117bd
(svn r4812) -Fix (FS#161) NTP properly checks for railtypes on non-plain-rail-tiles (Rubidium)
pathfind.c
--- a/pathfind.c	Wed May 10 06:23:43 2006 +0000
+++ b/pathfind.c	Wed May 10 09:38:29 2006 +0000
@@ -699,6 +699,10 @@
 				// 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 @@
 				// 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)