Fix OrderDestinationIsAllowed not handling nearest depot orders

pull/104/head
Jonathan G Rennison 5 years ago
parent 5008a09fe9
commit ca4db69f12

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

Loading…
Cancel
Save