|
|
|
@ -2984,7 +2984,7 @@ static FindDepotData FindClosestTrainDepot(Train *v, int max_distance)
|
|
|
|
|
|
|
|
|
|
if (IsRailDepotTile(v->tile)) return FindDepotData(v->tile, 0);
|
|
|
|
|
|
|
|
|
|
PBSTileInfo origin = FollowTrainReservation(v);
|
|
|
|
|
PBSTileInfo origin = FollowTrainReservation(v, nullptr, FTRF_OKAY_UNUSED);
|
|
|
|
|
if (IsRailDepotTile(origin.tile)) return FindDepotData(origin.tile, 0);
|
|
|
|
|
|
|
|
|
|
switch (_settings_game.pf.pathfinder_for_trains) {
|
|
|
|
@ -3927,7 +3927,7 @@ static void TryLongReserveChooseTrainTrack(Train *v, TileIndex tile, Trackdir td
|
|
|
|
|
|
|
|
|
|
static void TryLongReserveChooseTrainTrackFromReservationEnd(Train *v, bool no_reserve_vehicle_tile)
|
|
|
|
|
{
|
|
|
|
|
PBSTileInfo origin = FollowTrainReservation(v);
|
|
|
|
|
PBSTileInfo origin = FollowTrainReservation(v, nullptr, FTRF_OKAY_UNUSED);
|
|
|
|
|
if (IsRailDepotTile(origin.tile)) return;
|
|
|
|
|
|
|
|
|
|
ChooseTrainTrackLookAheadState lookahead_state;
|
|
|
|
@ -4012,7 +4012,7 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir,
|
|
|
|
|
v->lookahead.reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PBSTileInfo origin = FollowTrainReservation(v);
|
|
|
|
|
PBSTileInfo origin = FollowTrainReservation(v, nullptr, FTRF_OKAY_UNUSED);
|
|
|
|
|
PBSTileInfo res_dest(tile, INVALID_TRACKDIR, false);
|
|
|
|
|
DiagDirection dest_enterdir = enterdir;
|
|
|
|
|
if (do_track_reservation) {
|
|
|
|
@ -4083,7 +4083,7 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir,
|
|
|
|
|
/* No possible reservation target found, we are probably lost. */
|
|
|
|
|
if (res_dest.tile == INVALID_TILE) {
|
|
|
|
|
/* Try to find any safe destination. */
|
|
|
|
|
PBSTileInfo path_end = FollowTrainReservation(v);
|
|
|
|
|
PBSTileInfo path_end = FollowTrainReservation(v, nullptr, FTRF_OKAY_UNUSED);
|
|
|
|
|
if (TryReserveSafeTrack(v, path_end.tile, path_end.trackdir, false)) {
|
|
|
|
|
TrackBits res = GetReservedTrackbits(tile) & DiagdirReachesTracks(enterdir);
|
|
|
|
|
best_track = FindFirstTrack(res);
|
|
|
|
|