Add depot order flag for specific depot

Use upper half of order flags for extra depot flags

See: #302
This commit is contained in:
Jonathan G Rennison
2021-07-23 18:33:24 +01:00
parent fd0cb63963
commit 71dfd2900a
5 changed files with 25 additions and 0 deletions

View File

@@ -2478,6 +2478,13 @@ void VehicleEnterDepot(Vehicle *v)
return;
}
/* Test whether we are heading for this depot. If not, do nothing. */
if ((v->current_order.GetDepotExtraFlags() & ODEFB_SPECIFIC) &&
(v->type == VEH_AIRCRAFT ? v->current_order.GetDestination() != GetStationIndex(v->tile) : v->dest_tile != v->tile)) {
/* We are heading for another depot, keep driving. */
return;
}
if (v->current_order.GetDepotActionType() & ODATFB_SELL) {
_vehicles_to_sell.insert(v->index);
return;
@@ -3600,6 +3607,9 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command, Tile
} else if (!(command & DEPOT_SERVICE)) {
this->current_order.SetDepotActionType(ODATFB_HALT);
}
if (command & DEPOT_SPECIFIC) {
this->current_order.SetDepotExtraFlags(ODEFB_SPECIFIC);
}
SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, WID_VV_START_STOP);
/* If there is no depot in front and the train is not already reversing, reverse automatically (trains only) */