yapf/yapf_costrail.hpp
branchcustombridgeheads
changeset 5627 f5c656cf0a0e
parent 5626 1811beeb472f
equal deleted inserted replaced
5626:1811beeb472f 5627:f5c656cf0a0e
   198 		DEBUG(yapf, 3, "PfCalcCost(Node:tile=%04X td=%s; Parent:tile=%04X td=%s)", tile, GetTrackdirName(trackdir), prev_tile, GetTrackdirName(prev_trackdir));
   198 		DEBUG(yapf, 3, "PfCalcCost(Node:tile=%04X td=%s; Parent:tile=%04X td=%s)", tile, GetTrackdirName(trackdir), prev_tile, GetTrackdirName(prev_trackdir));
   199 
   199 
   200 		RailType rail_type = GetTileRailType(tile, trackdir);
   200 		RailType rail_type = GetTileRailType(tile, trackdir);
   201 
   201 
   202 		// detect exit from bridge wormhole
   202 		// detect exit from bridge wormhole
       
   203 		Trackdir intermediate_trackdir = INVALID_TRACKDIR;
   203 		if (IsBridgeTile(tile) && TrackdirToExitdir(ReverseTrackdir(trackdir)) == GetBridgeRampDirection(tile)) {
   204 		if (IsBridgeTile(tile) && TrackdirToExitdir(ReverseTrackdir(trackdir)) == GetBridgeRampDirection(tile)) {
   204 			// we are jumping over bridge (possible now with custom bridge heads) we must add the cost of skipped tiles
   205 			// we are jumping over bridge (possible now with custom bridge heads) we must add the cost of skipped tiles
   205 			int skipped_tiles = DistanceManhattan(prev_tile, tile) - 1;
   206 			int skipped_tiles = DistanceManhattan(prev_tile, tile) - 1;
   206 			if (skipped_tiles > 0) {
   207 			if (skipped_tiles > 0) {
   207 				segment_cost += skipped_tiles * YAPF_TILE_LENGTH;
   208 				segment_cost += skipped_tiles * YAPF_TILE_LENGTH;