mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Saveload: Add helper for null/ptr named save load table handling
This commit is contained in:
parent
38781fb16e
commit
c7a4c6ba0e
@ -2456,6 +2456,21 @@ SaveLoadTableData SlTableHeaderOrRiff(const NamedSaveLoadTable &slt)
|
||||
return saveloads;
|
||||
}
|
||||
|
||||
SaveLoadTableData SlPrepareNamedSaveLoadTableForPtrOrNull(const NamedSaveLoadTable &slt)
|
||||
{
|
||||
SaveLoadTableData saveloads;
|
||||
SlFilterNamedSaveLoadTable(slt, saveloads);
|
||||
for (auto &sld : saveloads) {
|
||||
if (sld.cmd == SL_STRUCTLIST || sld.cmd == SL_STRUCT) {
|
||||
std::unique_ptr<SaveLoadStructHandler> handler = sld.struct_handler_factory();
|
||||
sld.struct_handler = handler.get();
|
||||
saveloads.struct_handlers.push_back(std::move(handler));
|
||||
sld.struct_handler->table_data = SlPrepareNamedSaveLoadTableForPtrOrNull(sld.struct_handler->GetDescription());
|
||||
}
|
||||
}
|
||||
return saveloads;
|
||||
}
|
||||
|
||||
void SlSaveTableObjectChunk(const SaveLoadTable &slt)
|
||||
{
|
||||
SlSetArrayIndex(0);
|
||||
|
@ -1094,6 +1094,7 @@ bool SlIsTableChunk();
|
||||
void SlSkipTableHeader();
|
||||
SaveLoadTableData SlTableHeader(const NamedSaveLoadTable &slt, TableHeaderSpecialHandler *special_handler = nullptr);
|
||||
SaveLoadTableData SlTableHeaderOrRiff(const NamedSaveLoadTable &slt);
|
||||
SaveLoadTableData SlPrepareNamedSaveLoadTableForPtrOrNull(const NamedSaveLoadTable &slt);
|
||||
void SlSaveTableObjectChunk(const SaveLoadTable &slt);
|
||||
void SlLoadTableOrRiffFiltered(const SaveLoadTable &slt);
|
||||
void SlLoadTableWithArrayLengthPrefixesMissing();
|
||||
|
Loading…
Reference in New Issue
Block a user