src/yapf/yapf_road.cpp
branchnoai
changeset 10645 8cbdb511a674
parent 10455 22c441f5adf9
child 10715 6bdf79ffb022
equal deleted inserted replaced
10644:6c4314786d68 10645:8cbdb511a674
    86 			const Vehicle* v = Yapf().GetVehicle();
    86 			const Vehicle* v = Yapf().GetVehicle();
    87 			// we have reached the vehicle's destination - segment should end here to avoid target skipping
    87 			// we have reached the vehicle's destination - segment should end here to avoid target skipping
    88 			if (v->current_order.IsType(OT_GOTO_STATION) && tile == v->dest_tile) break;
    88 			if (v->current_order.IsType(OT_GOTO_STATION) && tile == v->dest_tile) break;
    89 
    89 
    90 			// stop if we have just entered the depot
    90 			// stop if we have just entered the depot
    91 			if (IsRoadDepotTile(tile) && trackdir == DiagdirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {
    91 			if (IsRoadDepotTile(tile) && trackdir == DiagDirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {
    92 				// next time we will reverse and leave the depot
    92 				// next time we will reverse and leave the depot
    93 				break;
    93 				break;
    94 			}
    94 			}
    95 
    95 
    96 			// if there are no reachable trackdirs on new tile, we have end of road
    96 			// if there are no reachable trackdirs on new tile, we have end of road
   262 	FORCEINLINE Trackdir ChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir)
   262 	FORCEINLINE Trackdir ChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir)
   263 	{
   263 	{
   264 		// handle special case - when next tile is destination tile
   264 		// handle special case - when next tile is destination tile
   265 		if (tile == v->dest_tile) {
   265 		if (tile == v->dest_tile) {
   266 			// choose diagonal trackdir reachable from enterdir
   266 			// choose diagonal trackdir reachable from enterdir
   267 			return (Trackdir)DiagdirToDiagTrackdir(enterdir);
   267 			return DiagDirToDiagTrackdir(enterdir);
   268 		}
   268 		}
   269 		// our source tile will be the next vehicle tile (should be the given one)
   269 		// our source tile will be the next vehicle tile (should be the given one)
   270 		TileIndex src_tile = tile;
   270 		TileIndex src_tile = tile;
   271 		// get available trackdirs on the start tile
   271 		// get available trackdirs on the start tile
   272 		TrackdirBits src_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes));
   272 		TrackdirBits src_trackdirs = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes));