Use upstream/table format for game log chunk

This commit is contained in:
Jonathan G Rennison
2024-02-11 16:34:03 +00:00
parent 0f7eb3d8d5
commit 1e2834a422
3 changed files with 9 additions and 26 deletions

View File

@@ -113,7 +113,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_TEMPLATE_REPLACEMENT, XSCF_NULL, 9, 9, "template_replacement", nullptr, nullptr, "TRPL,TMPL" },
{ XSLFI_MORE_RAIL_TYPES, XSCF_NULL, 0, 1, "more_rail_types", nullptr, nullptr, nullptr },
{ XSLFI_CARGO_TYPE_ORDERS, XSCF_NULL, 3, 3, "cargo_type_orders", nullptr, nullptr, "ORDX,VEOX" },
{ XSLFI_EXTENDED_GAMELOG, XSCF_NULL, 1, 1, "extended_gamelog", nullptr, nullptr, nullptr },
{ XSLFI_EXTENDED_GAMELOG, XSCF_NULL, 2, 2, "extended_gamelog", nullptr, nullptr, nullptr },
{ XSLFI_STATION_CATCHMENT_INC, XSCF_NULL, 1, 1, "station_catchment_inc", nullptr, nullptr, nullptr },
{ XSLFI_CUSTOM_BRIDGE_HEADS, XSCF_NULL, 4, 4, "custom_bridge_heads", nullptr, nullptr, nullptr },
{ XSLFI_CHUNNEL, XSCF_NULL, 2, 2, "chunnel", nullptr, nullptr, "TUNN" },

View File

@@ -129,24 +129,6 @@ static void Load_GLOG_common(std::vector<LoggedAction> &gamelog_actions)
}
}
static void Save_GLOG()
{
SlAutolength([](void *) {
for (LoggedAction &la : _gamelog_actions) {
SlWriteByte(la.at);
SlObject(&la, _glog_action_desc);
for (LoggedChange &lc : la.changes) {
SlWriteByte(lc.ct);
assert((uint)lc.ct < GLCT_END);
SlObject(&lc, _glog_desc[lc.ct]);
}
SlWriteByte(GLCT_NONE);
}
SlWriteByte(GLAT_NONE);
}, nullptr);
}
static void Load_GLOG()
{
Load_GLOG_common(_gamelog_actions);
@@ -158,7 +140,7 @@ static void Check_GLOG()
}
static const ChunkHandler gamelog_chunk_handlers[] = {
{ 'GLOG', Save_GLOG, Load_GLOG, nullptr, Check_GLOG, CH_RIFF }
MakeSaveUpstreamFeatureConditionalLoadUpstreamChunkHandler<'GLOG', XSLFI_EXTENDED_GAMELOG, 2>(Load_GLOG, nullptr, Check_GLOG),
};
extern const ChunkHandlerTable _gamelog_chunk_handlers(gamelog_chunk_handlers);