diff --git a/src/order_base.h b/src/order_base.h index 9b4292db15..af78e0fb60 100644 --- a/src/order_base.h +++ b/src/order_base.h @@ -45,6 +45,8 @@ private: friend const struct SaveLoad *GetOrderDescription(); ///< Saving and loading of orders. friend void Load_ORDX(); ///< Saving and loading of orders. friend void Save_ORDX(); ///< Saving and loading of orders. + friend void Load_VEOX(); ///< Saving and loading of orders. + friend void Save_VEOX(); ///< Saving and loading of orders. uint8 type; ///< The type of order + non-stop flags uint8 flags; ///< Load/unload types, depot order/action types. diff --git a/src/saveload/extended_ver_sl.cpp b/src/saveload/extended_ver_sl.cpp index 0efa275764..66c09f3e36 100644 --- a/src/saveload/extended_ver_sl.cpp +++ b/src/saveload/extended_ver_sl.cpp @@ -45,7 +45,7 @@ std::vector _sl_xv_discardable_chunk_ids; ///< list of chunks static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version os SLXI chunk const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = { - { XSLFI_CARGO_TYPE_ORDERS, XSCF_NULL, 1, 1, "cargo_type_orders", NULL, NULL, "ORDX" }, + { XSLFI_CARGO_TYPE_ORDERS, XSCF_NULL, 2, 2, "cargo_type_orders", NULL, NULL, "ORDX,VEOX" }, { XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker }; diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index ebc5fc4215..4327cd383c 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -934,6 +934,33 @@ static void Ptrs_VEHS() } } +const SaveLoad *GetOrderExtraInfoDescription(); + +void Save_VEOX() +{ + /* save extended order info for vehicle current order */ + Vehicle *v; + FOR_ALL_VEHICLES(v) { + if (v->current_order.extra) { + SlSetArrayIndex(v->index); + SlObject(v->current_order.extra.get(), GetOrderExtraInfoDescription()); + } + } +} + +void Load_VEOX() +{ + /* load extended order info for vehicle current order */ + int index; + while ((index = SlIterateArray()) != -1) { + Vehicle *v = Vehicle::GetIfValid(index); + assert(v != NULL); + v->current_order.AllocExtraInfo(); + SlObject(v->current_order.extra.get(), GetOrderExtraInfoDescription()); + } +} + extern const ChunkHandler _veh_chunk_handlers[] = { - { 'VEHS', Save_VEHS, Load_VEHS, Ptrs_VEHS, NULL, CH_SPARSE_ARRAY | CH_LAST}, + { 'VEHS', Save_VEHS, Load_VEHS, Ptrs_VEHS, NULL, CH_SPARSE_ARRAY}, + { 'VEOX', Save_VEOX, Load_VEOX, NULL, NULL, CH_SPARSE_ARRAY | CH_LAST}, };