src/yapf/yapf_costbase.hpp
branchNewGRF_ports
changeset 6872 1c4a4a609f85
parent 5726 8f399788f6c9
child 6878 7d1ff2f621c7
--- a/src/yapf/yapf_costbase.hpp	Mon Dec 03 23:39:38 2007 +0000
+++ b/src/yapf/yapf_costbase.hpp	Tue Jan 22 21:00:30 2008 +0000
@@ -11,13 +11,11 @@
 		if (IsDiagonalTrackdir(td)) {
 			if (IsBridgeTile(tile)) {
 				// it is bridge ramp, check if we are entering the bridge
-				if (GetBridgeRampDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are living it, no penalty
+				if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are living it, no penalty
 				// we are entering the bridge
-				// if the tile slope is downwards, then bridge ramp has not upward slope
-				uint tile_slope = GetTileSlope(tile, NULL) & 0x0F;
-				if ((c_upwards_slopes[tile_slope] & TrackdirToTrackdirBits(ReverseTrackdir(td))) != 0) return false; // tile under ramp goes down, no penalty
-				// tile under ramp isn't going down, so ramp must go up
-				return true;
+				Slope tile_slope = GetTileSlope(tile, NULL);
+				Axis axis = DiagDirToAxis(GetTunnelBridgeDirection(tile));
+				return !HasBridgeFlatRamp(tile_slope, axis);
 			} else {
 				// not bridge ramp
 				if (IsTunnelTile(tile)) return false; // tunnel entry/exit doesn't slope