src/yapf/yapf_costrail.hpp
branchcustombridgeheads
changeset 5650 aefc131bf5ce
parent 5643 3778051e8095
equal deleted inserted replaced
5649:55c8267c933f 5650:aefc131bf5ce
   193 
   193 
   194 		TileIndex tile = n.m_key.m_tile;
   194 		TileIndex tile = n.m_key.m_tile;
   195 		Trackdir trackdir = n.m_key.m_td;
   195 		Trackdir trackdir = n.m_key.m_td;
   196 		TileType tile_type = GetTileType(tile);
   196 		TileType tile_type = GetTileType(tile);
   197 
   197 
   198 		DEBUG(yapf, 3, "PfCalcCost(Node:tile=%04X td=%s; Parent:tile=%04X td=%s)", tile, GetTrackdirName(trackdir), prev_tile, GetTrackdirName(prev_trackdir));
   198 		RailType rail_type = GetTileRailType(tile, TrackdirToTrack(trackdir));
   199 
       
   200 		RailType rail_type = GetTileRailType(tile, trackdir);
       
   201 
   199 
   202 		// detect exit from bridge wormhole
   200 		// detect exit from bridge wormhole
   203 		Trackdir intermediate_trackdir = INVALID_TRACKDIR;
   201 		Trackdir intermediate_trackdir = INVALID_TRACKDIR;
   204 		if (IsBridgeTile(tile) && TrackdirToExitdir(ReverseTrackdir(trackdir)) == GetBridgeRampDirection(tile)) {
   202 		if (IsBridgeTile(tile) && TrackdirToExitdir(ReverseTrackdir(trackdir)) == GetBridgeRampDirection(tile)) {
   205 			// we are jumping over bridge (possible now with custom bridge heads) we must add the cost of skipped tiles
   203 			// we are jumping over bridge (possible now with custom bridge heads) we must add the cost of skipped tiles
   284 				}
   282 				}
   285 			}
   283 			}
   286 
   284 
   287 			// if rail type changes, finish segment (cached segment can't contain more rail types)
   285 			// if rail type changes, finish segment (cached segment can't contain more rail types)
   288 			{
   286 			{
   289 				RailType new_rail_type = GetTileRailType(F.m_new_tile, (Trackdir)FindFirstBit2x64(F.m_new_td_bits));
   287 				RailType new_rail_type = GetTileRailType(F.m_new_tile, TrackdirToTrack(FindFirstTrackdir(F.m_new_td_bits)));
   290 				if (new_rail_type != rail_type) {
   288 				if (new_rail_type != rail_type) {
   291 					DEBUG(yapf, 4, "  end: rail type changes");
   289 					DEBUG(yapf, 4, "  end: rail type changes");
   292 					break;
   290 					break;
   293 				}
   291 				}
   294 				rail_type = new_rail_type;
   292 				rail_type = new_rail_type;