diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 4d7ce518ad..cc0e94a5e3 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -496,6 +496,13 @@ static void ShipArrivesAt(const Vehicle *v, Station *st) */ static Track ChooseShipTrack(Ship *v, TileIndex tile, TrackBits tracks) { + /* Before choosing a track, if close to the destination station or depot (not an oil rig)... */ + if (DistanceManhattan(v->dest_tile, tile) <= 5 && (v->current_order.IsType(OT_GOTO_DEPOT) && + (!IsShipDepotTile(v->dest_tile) || (IsExtendedDepotTile(v->dest_tile) && !IsExtendedDepotEmpty(v->dest_tile))))) { + /* Try to get a depot tile. */ + v->dest_tile = Depot::Get(v->current_order.GetDestination())->GetBestDepotTile(v); + } + bool path_found = true; Track track;