Add xdata2 field to OrderExtraInfo
This commit is contained in:
@@ -75,6 +75,7 @@ void ClearOrderDestinationRefcountMap();
|
||||
struct OrderExtraInfo {
|
||||
uint8 cargo_type_flags[NUM_CARGO] = {}; ///< Load/unload types for each cargo type.
|
||||
uint32 xdata = 0; ///< Extra arbitrary data
|
||||
uint32 xdata2 = 0; ///< Extra arbitrary data
|
||||
uint16 dispatch_index = 0; ///< Scheduled dispatch index + 1
|
||||
uint8 xflags = 0; ///< Extra flags
|
||||
uint8 colour = 0; ///< Order colour + 1
|
||||
@@ -150,6 +151,17 @@ public:
|
||||
return this->extra->xdata;
|
||||
}
|
||||
|
||||
inline uint32 GetXData2() const
|
||||
{
|
||||
return this->extra != nullptr ? this->extra->xdata2 : 0;
|
||||
}
|
||||
|
||||
inline uint32 &GetXData2Ref()
|
||||
{
|
||||
CheckExtraInfoAlloced();
|
||||
return this->extra->xdata2;
|
||||
}
|
||||
|
||||
Order *next; ///< Pointer to next order. If nullptr, end of list
|
||||
|
||||
Order() : flags(0), refit_cargo(CT_NO_REFIT), max_speed(UINT16_MAX) {}
|
||||
|
@@ -407,7 +407,9 @@ void Order::AssignOrder(const Order &other)
|
||||
this->travel_time = other.travel_time;
|
||||
this->max_speed = other.max_speed;
|
||||
|
||||
if (other.extra != nullptr && (this->GetUnloadType() == OUFB_CARGO_TYPE_UNLOAD || this->GetLoadType() == OLFB_CARGO_TYPE_LOAD || other.extra->xdata != 0 || other.extra->xflags != 0 || other.extra->dispatch_index != 0)) {
|
||||
if (other.extra != nullptr && (this->GetUnloadType() == OUFB_CARGO_TYPE_UNLOAD || this->GetLoadType() == OLFB_CARGO_TYPE_LOAD
|
||||
|| (this->IsType(OT_LABEL) && this->GetLabelSubType() == OLST_TEXT)
|
||||
|| other.extra->xdata != 0 || other.extra->xdata2 != 0 || other.extra->xflags != 0 || other.extra->dispatch_index != 0)) {
|
||||
this->AllocExtraInfo();
|
||||
*(this->extra) = *(other.extra);
|
||||
} else {
|
||||
|
@@ -122,7 +122,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_TRAIN_FLAGS_EXTRA, XSCF_NULL, 1, 1, "train_flags_extra", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_VEHICLE_FLAGS_EXTRA, XSCF_NULL, 1, 1, "veh_flags_extra", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_TRAIN_THROUGH_LOAD, XSCF_NULL, 2, 2, "train_through_load", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_ORDER_EXTRA_DATA, XSCF_NULL, 2, 2, "order_extra_data", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_ORDER_EXTRA_DATA, XSCF_NULL, 3, 3, "order_extra_data", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_WHOLE_MAP_CHUNK, XSCF_NULL, 2, 2, "whole_map_chunk", nullptr, nullptr, "WMAP" },
|
||||
{ XSLFI_ST_LAST_VEH_TYPE, XSCF_NULL, 1, 1, "station_last_veh_type", nullptr, nullptr, nullptr },
|
||||
{ XSLFI_SELL_AT_DEPOT_ORDER, XSCF_NULL, 1, 1, "sell_at_depot_order", nullptr, nullptr, nullptr },
|
||||
|
@@ -217,6 +217,7 @@ const SaveLoadTable GetOrderExtraInfoDescription()
|
||||
SLE_CONDARR_X(OrderExtraInfo, cargo_type_flags, SLE_UINT8, NUM_CARGO, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_CARGO_TYPE_ORDERS, 3)),
|
||||
SLE_CONDVAR_X(OrderExtraInfo, xflags, SLE_UINT8, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_TIMETABLE_EXTRA)),
|
||||
SLE_CONDVAR_X(OrderExtraInfo, xdata, SLE_UINT32, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_ORDER_EXTRA_DATA)),
|
||||
SLE_CONDVAR_X(OrderExtraInfo, xdata2, SLE_UINT32, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_ORDER_EXTRA_DATA, 3)),
|
||||
SLE_CONDVAR_X(OrderExtraInfo, dispatch_index, SLE_UINT16, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_SCHEDULED_DISPATCH, 3)),
|
||||
SLE_CONDVAR_X(OrderExtraInfo, colour, SLE_UINT8, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_ORDER_EXTRA_DATA, 2)),
|
||||
};
|
||||
|
Reference in New Issue
Block a user