Merge branch 'cargo_type_order' into jgrpp

# Conflicts:
#	src/saveload/extended_ver_sl.cpp
This commit is contained in:
Jonathan G Rennison
2016-10-11 19:02:03 +01:00
3 changed files with 31 additions and 2 deletions

View File

@@ -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.

View File

@@ -70,7 +70,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_LINKGRAPH_DAY_SCALE, XSCF_NULL, 1, 1, "linkgraph_day_scale", NULL, NULL, NULL },
{ XSLFI_TEMPLATE_REPLACEMENT, XSCF_NULL, 1, 1, "template_replacement", NULL, NULL, "TRPL,TMPL" },
{ XSLFI_MORE_RAIL_TYPES, XSCF_NULL, 1, 1, "more_rail_types", NULL, NULL, NULL },
{ 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_EXTENDED_GAMELOG, XSCF_NULL, 1, 1, "extended_gamelog", NULL, NULL, NULL },
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker

View File

@@ -978,6 +978,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},
};