yapf/yapf_costrail.hpp
branchcustombridgeheads
changeset 5609 ec38986d2c8e
parent 5095 fd35de11728c
child 5616 0570ae953222
--- a/yapf/yapf_costrail.hpp	Sat Dec 30 17:35:08 2006 +0000
+++ b/yapf/yapf_costrail.hpp	Sat Dec 30 18:25:01 2006 +0000
@@ -191,6 +191,12 @@
 
 		RailType rail_type = GetTileRailType(tile, trackdir);
 
+		// detect exit from bridge wormhole
+		if (IsBridgeTile(tile) && TrackdirToExitdir(ReverseTrackdir(trackdir)) == GetBridgeRampDirection(tile)) {
+			// we are jumping over bridge (possible now with custom bridge heads) we must add the cost of skipped tiles
+			segment_cost += (DistanceManhattan(prev_tile, tile) - 1) * YAPF_TILE_LENGTH;
+		}
+
 		bool target_seen = Yapf().PfDetectDestination(tile, trackdir);
 
 		while (true) {