src/pathfind.cpp
branchgamebalance
changeset 9912 1ac8aac92385
parent 9910 0b2aebc8283e
child 7567 8723fa633d31
child 9629 66dde6412125
--- a/src/pathfind.cpp	Wed Jun 13 11:45:14 2007 +0000
+++ b/src/pathfind.cpp	Wed Jun 13 12:05:56 2007 +0000
@@ -153,7 +153,7 @@
 	if (++tpf->rd.cur_length > 50)
 		return;
 
-	bits = GetTileTrackStatus(tile, tpf->tracktype);
+	bits = GetTileTrackStatus(tile, tpf->tracktype, tpf->sub_type);
 	bits = (byte)((bits | (bits >> 8)) & _bits_mask[direction]);
 	if (bits == 0)
 		return;
@@ -322,7 +322,7 @@
 
 	tpf->rd.cur_length++;
 
-	bits = GetTileTrackStatus(tile, tpf->tracktype);
+	bits = GetTileTrackStatus(tile, tpf->tracktype, tpf->sub_type);
 
 	if ((byte)bits != tpf->var2) {
 		bits &= _tpfmode1_and[direction];
@@ -363,7 +363,7 @@
 	direction = ReverseDiagDir(direction);
 	tile += TileOffsByDiagDir(direction);
 
-	bits = GetTileTrackStatus(tile, tpf->tracktype);
+	bits = GetTileTrackStatus(tile, tpf->tracktype, tpf->sub_type);
 	bits |= (bits >> 8);
 
 	if ( (byte)bits != tpf->var2) {
@@ -388,7 +388,7 @@
 	} while (bits != 0);
 }
 
-void FollowTrack(TileIndex tile, uint16 flags, DiagDirection direction, TPFEnumProc *enum_proc, TPFAfterProc *after_proc, void *data)
+void FollowTrack(TileIndex tile, uint16 flags, uint sub_type, DiagDirection direction, TPFEnumProc *enum_proc, TPFAfterProc *after_proc, void *data)
 {
 	TrackPathFinder tpf;
 
@@ -411,6 +411,7 @@
 
 
 	tpf.tracktype = (TransportType)(flags & 0xFF);
+	tpf.sub_type = sub_type;
 
 	if (HASBIT(flags, 11)) {
 		tpf.rd.pft_var6 = 0xFF;
@@ -783,7 +784,7 @@
 			if (!IsTileType(tile, MP_RAILWAY) || !IsPlainRailTile(tile)) {
 				/* We found a tile which is not a normal railway tile.
 				 * Determine which tracks that exist on this tile. */
-				uint32 ts = GetTileTrackStatus(tile, TRANSPORT_RAIL) & _tpfmode1_and[direction];
+				uint32 ts = GetTileTrackStatus(tile, TRANSPORT_RAIL, 0) & _tpfmode1_and[direction];
 				bits = TrackdirBitsToTrackBits((TrackdirBits)(ts & TRACKDIR_BIT_MASK));
 
 				/* Check that the tile contains exactly one track */