1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-20 13:09:15 +00:00

Change: Get a better depot when close to destination tile of depots.

This commit is contained in:
J0anJosep
2020-12-24 00:34:54 +01:00
parent 01ac0e653f
commit e91483c588

View File

@@ -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;