src/pathfind.cpp
changeset 8579 3efbb430092e
parent 8467 2f293250afac
child 8584 a8b6dffead63
--- a/src/pathfind.cpp	Sun Dec 16 10:54:08 2007 +0000
+++ b/src/pathfind.cpp	Sun Dec 16 15:38:51 2007 +0000
@@ -17,6 +17,7 @@
 #include "tunnel_map.h"
 #include "variables.h"
 #include "depot.h"
+#include "tunnelbridge_map.h"
 
 /* remember which tiles we have already visited so we don't visit them again. */
 static bool TPFSetTileBit(TrackPathFinder *tpf, TileIndex tile, int dir)
@@ -210,7 +211,7 @@
 		tile += delta;
 	} while(
 		!IsTunnelTile(tile) ||
-		GetTunnelDirection(tile) != dir ||
+		GetTunnelBridgeDirection(tile) != dir ||
 		GetTileZ(tile) != z
 	);
 
@@ -260,13 +261,13 @@
 	 * and transport type match */
 	if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 		if (IsTunnel(tile)) {
-			if (GetTunnelDirection(tile) != direction ||
-					GetTunnelTransportType(tile) != tpf->tracktype) {
+			if (GetTunnelBridgeDirection(tile) != direction ||
+					GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
 				return;
 			}
 		} else if (IsBridge(tile)) {
-			if (GetBridgeRampDirection(tile) != direction ||
-					GetBridgeTransportType(tile) != tpf->tracktype) {
+			if (GetTunnelBridgeDirection(tile) != direction ||
+					GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
 				return;
 			}
 		}
@@ -307,23 +308,23 @@
 
 	if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 		if (IsTunnel(tile)) {
-			if (GetTunnelTransportType(tile) != tpf->tracktype) {
+			if (GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
 				return;
 			}
 			/* Only skip through the tunnel if heading inwards. We can
 			 * be headed outwards if our starting position was in a
 			 * tunnel and we're pathfinding backwards */
-			if (GetTunnelDirection(tile) == direction) {
+			if (GetTunnelBridgeDirection(tile) == direction) {
 				tile = SkipToEndOfTunnel(tpf, tile, direction);
-			} else if (GetTunnelDirection(tile) != ReverseDiagDir(direction)) {
+			} else if (GetTunnelBridgeDirection(tile) != ReverseDiagDir(direction)) {
 				/* We don't support moving through the sides of a tunnel
 				 * entrance :-) */
 				return;
 			}
 		} else {
 			TileIndex tile_end;
-			if (GetBridgeRampDirection(tile) != direction ||
-					GetBridgeTransportType(tile) != tpf->tracktype) {
+			if (GetTunnelBridgeDirection(tile) != direction ||
+					GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
 				return;
 			}
 			//fprintf(stderr, "%s: Planning over bridge\n", __func__);
@@ -722,12 +723,12 @@
 		 *   need to find the exit of the tunnel. */
 		if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 			if (IsTunnel(tile)) {
-				if (GetTunnelDirection(tile) != ReverseDiagDir(direction)) {
+				if (GetTunnelBridgeDirection(tile) != ReverseDiagDir(direction)) {
 					FindLengthOfTunnelResult flotr;
 
 					/* We are not just driving out of the tunnel */
-					if (GetTunnelDirection(tile) != direction ||
-							GetTunnelTransportType(tile) != tpf->tracktype) {
+					if (GetTunnelBridgeDirection(tile) != direction ||
+							GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
 						/* We are not driving into the tunnel, or it is an invalid tunnel */
 						continue;
 					}
@@ -742,10 +743,10 @@
 				}
 			} else {
 				TileIndex tile_end;
-				if (GetBridgeRampDirection(tile) != ReverseDiagDir(direction)) {
+				if (GetTunnelBridgeDirection(tile) != ReverseDiagDir(direction)) {
 					/* We are not just leaving the bridge */
-					if (GetBridgeRampDirection(tile) != direction ||
-							GetBridgeTransportType(tile) != tpf->tracktype) {
+					if (GetTunnelBridgeDirection(tile) != direction ||
+							GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
 						/* Not entering the bridge or not compatible */
 						continue;
 					}