Saveload: Use template function to implement SlAutolength

This commit is contained in:
Jonathan G Rennison
2024-07-14 18:45:17 +01:00
parent 74047028dd
commit 99c6cc5bdb
9 changed files with 34 additions and 24 deletions

View File

@@ -2383,19 +2383,17 @@ void SlGlobList(const SaveLoadTable &slt)
SlObject(nullptr, slt);
}
/**
* Do something of which I have no idea what it is :P
* @param proc The callback procedure that is called
* @param arg The variable that will be used for the callback procedure
*/
void SlAutolength(AutolengthProc *proc, void *arg)
void SlAutolengthSetup()
{
assert(_sl.action == SLA_SAVE);
assert(_sl.need_length == NL_WANTLENGTH);
_sl.need_length = NL_NONE;
_sl.dumper->StartAutoLength();
proc(arg);
}
void SlAutolengthCompletion()
{
auto result = _sl.dumper->StopAutoLength();
/* Setup length */
_sl.need_length = NL_WANTLENGTH;