From 61f920138f421b4e4a498890c2220cad6e25e651 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 7 Jul 2024 15:34:09 +0100 Subject: [PATCH] Saveload: Add helper to skip chunk contents --- src/sl/saveload.cpp | 11 +++++++++++ src/sl/saveload.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/sl/saveload.cpp b/src/sl/saveload.cpp index 329984e556..8994b5f33e 100644 --- a/src/sl/saveload.cpp +++ b/src/sl/saveload.cpp @@ -2332,6 +2332,17 @@ void SlLoadTableWithArrayLengthPrefixesMissing() SetBit(_sl.block_flags, SLBF_TABLE_ARRAY_LENGTH_PREFIX_MISSING); } +void SlSkipChunkContents() +{ + if (SlIsTableChunk()) SlSkipTableHeader(); + + if (_sl.block_mode == CH_RIFF) { + SlSkipBytes(SlGetFieldLength()); + } else { + SlSkipArray(); + } +} + /** * Save or Load (a list of) global variables. * @param slt The SaveLoad table with objects to save/load. diff --git a/src/sl/saveload.h b/src/sl/saveload.h index 10795c8be0..31e8a02d97 100644 --- a/src/sl/saveload.h +++ b/src/sl/saveload.h @@ -1079,6 +1079,8 @@ void SlSaveTableObjectChunk(const SaveLoadTable &slt); void SlLoadTableOrRiffFiltered(const SaveLoadTable &slt); void SlLoadTableWithArrayLengthPrefixesMissing(); +void SlSkipChunkContents(); + inline void SlSaveTableObjectChunk(const NamedSaveLoadTable &slt) { SlSaveTableObjectChunk(SlTableHeader(slt));