Add depot order flag for specific depot
Use upper half of order flags for extra depot flags See: #302
This commit is contained in:
@@ -324,6 +324,8 @@ public:
|
||||
inline OrderDepotTypeFlags GetDepotOrderType() const { return (OrderDepotTypeFlags)GB(this->flags, 0, 3); }
|
||||
/** What are we going to do when in the depot. */
|
||||
inline OrderDepotActionFlags GetDepotActionType() const { return (OrderDepotActionFlags)GB(this->flags, 4, 3); }
|
||||
/** Extra depot flags. */
|
||||
inline OrderDepotExtraFlags GetDepotExtraFlags() const { return (OrderDepotExtraFlags)GB(this->flags, 8, 8); }
|
||||
/** What waypoint flags? */
|
||||
inline OrderWaypointFlags GetWaypointFlags() const { return (OrderWaypointFlags)GB(this->flags, 0, 3); }
|
||||
/** What variable do we have to compare? */
|
||||
@@ -385,6 +387,8 @@ public:
|
||||
inline void SetDepotOrderType(OrderDepotTypeFlags depot_order_type) { SB(this->flags, 0, 3, depot_order_type); }
|
||||
/** Set what we are going to do in the depot. */
|
||||
inline void SetDepotActionType(OrderDepotActionFlags depot_service_type) { SB(this->flags, 4, 3, depot_service_type); }
|
||||
/** Set what we are going to do in the depot. */
|
||||
inline void SetDepotExtraFlags(OrderDepotExtraFlags depot_extra_flags) { SB(this->flags, 8, 8, depot_extra_flags); }
|
||||
/** Set waypoint flags. */
|
||||
inline void SetWaypointFlags(OrderWaypointFlags waypoint_flags) { SB(this->flags, 0, 3, waypoint_flags); }
|
||||
/** Set variable we have to compare. */
|
||||
|
@@ -117,6 +117,15 @@ enum OrderDepotActionFlags {
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(OrderDepotActionFlags)
|
||||
|
||||
/**
|
||||
* Extra depot flags.
|
||||
*/
|
||||
enum OrderDepotExtraFlags {
|
||||
ODEF_NONE = 0, ///< No flags.
|
||||
ODEFB_SPECIFIC = 1 << 0, ///< This order is for a specific depot.
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(OrderDepotExtraFlags)
|
||||
|
||||
/**
|
||||
* Flags for go to waypoint orders
|
||||
*/
|
||||
|
@@ -154,6 +154,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_STATION_CARGO_HISTORY, XSCF_NULL, 1, 1, "station_cargo_history", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_TRAIN_SPEED_ADAPTATION, XSCF_NULL, 1, 1, "train_speed_adaptation", nullptr, nullptr, "TSAS" },
|
||||
{ XSLFI_EXTRA_STATION_NAMES, XSCF_NULL, 1, 1, "extra_station_names", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_DEPOT_ORDER_EXTRA_FLAGS,XSCF_IGNORABLE_UNKNOWN, 1, 1, "depot_order_extra_flags", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker
|
||||
};
|
||||
|
||||
|
@@ -108,6 +108,7 @@ enum SlXvFeatureIndex {
|
||||
XSLFI_STATION_CARGO_HISTORY, ///< Station waiting cargo history
|
||||
XSLFI_TRAIN_SPEED_ADAPTATION, ///< Train speed adaptation
|
||||
XSLFI_EXTRA_STATION_NAMES, ///< Extra station names
|
||||
XSLFI_DEPOT_ORDER_EXTRA_FLAGS, ///< Depot order extra flags
|
||||
|
||||
XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit
|
||||
XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk
|
||||
|
@@ -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) */
|
||||
|
Reference in New Issue
Block a user