diff --git a/src/infrastructure.cpp b/src/infrastructure.cpp index 6e4bd87e31..e44e4ee3f1 100644 --- a/src/infrastructure.cpp +++ b/src/infrastructure.cpp @@ -147,11 +147,19 @@ static bool OrderDestinationIsAllowed(const Order *order, const Vehicle *v, Owne switch (order->GetType()) { case OT_IMPLICIT: case OT_GOTO_STATION: - case OT_GOTO_WAYPOINT: dest_owner = BaseStation::Get(order->GetDestination())->owner; break; - case OT_GOTO_DEPOT: dest_owner = (v->type == VEH_AIRCRAFT) ? Station::Get(order->GetDestination())->owner : GetTileOwner(Depot::Get(order->GetDestination())->xy); break; + case OT_GOTO_WAYPOINT: + dest_owner = BaseStation::Get(order->GetDestination())->owner; + break; + case OT_GOTO_DEPOT: + if ((order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) return true; + dest_owner = (v->type == VEH_AIRCRAFT) ? Station::Get(order->GetDestination())->owner : GetTileOwner(Depot::Get(order->GetDestination())->xy); + break; case OT_LOADING_ADVANCE: - case OT_LOADING: dest_owner = Station::Get(v->last_station_visited)->owner; break; - default: return true; + case OT_LOADING: + dest_owner = Station::Get(v->last_station_visited)->owner; + break; + default: + return true; } return dest_owner != owner && IsInfraUsageAllowed(v->type, v->owner, dest_owner); }