(svn r7655) [cbh] - Fix: [YAPF] another assert (on opposite cbh when it contained choice). Now it is possible to reach choice when exiting wormhole. So the wormhole cost must be taken into consideration when starting new YAPF node. custombridgeheads
authorKUDr
Sat, 30 Dec 2006 18:25:01 +0000
branchcustombridgeheads
changeset 5609 ec38986d2c8e
parent 5608 a0768f524071
child 5610 f67ca2533978
(svn r7655) [cbh] - Fix: [YAPF] another assert (on opposite cbh when it contained choice). Now it is possible to reach choice when exiting wormhole. So the wormhole cost must be taken into consideration when starting new YAPF node.
yapf/yapf_costrail.hpp
--- 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) {