mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Saveload: Add helper to filter named save load table
This commit is contained in:
parent
c7a4c6ba0e
commit
7bf1cf0865
@ -1990,6 +1990,21 @@ std::vector<SaveLoad> SlFilterObject(const SaveLoadTable &slt)
|
||||
return save;
|
||||
}
|
||||
|
||||
void SlFilterNamedSaveLoadTable(const NamedSaveLoadTable &nslt, std::vector<SaveLoad> &save)
|
||||
{
|
||||
for (auto &nsld : nslt) {
|
||||
if ((nsld.nsl_flags & NSLF_TABLE_ONLY) != 0) continue;
|
||||
SlFilterObjectMember(nsld.save_load, save);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<SaveLoad> SlFilterNamedSaveLoadTable(const NamedSaveLoadTable &nslt)
|
||||
{
|
||||
std::vector<SaveLoad> save;
|
||||
SlFilterNamedSaveLoadTable(nslt, save);
|
||||
return save;
|
||||
}
|
||||
|
||||
template <SaveLoadAction action, bool check_version>
|
||||
bool SlObjectMemberGeneric(void *object, const SaveLoad &sld)
|
||||
{
|
||||
@ -2449,10 +2464,7 @@ SaveLoadTableData SlTableHeaderOrRiff(const NamedSaveLoadTable &slt)
|
||||
if (SlIsTableChunk()) return SlTableHeader(slt);
|
||||
|
||||
SaveLoadTableData saveloads;
|
||||
for (auto &nsld : slt) {
|
||||
if ((nsld.nsl_flags & NSLF_TABLE_ONLY) != 0) continue;
|
||||
SlFilterObjectMember(nsld.save_load, saveloads);
|
||||
}
|
||||
SlFilterNamedSaveLoadTable(slt, saveloads);
|
||||
return saveloads;
|
||||
}
|
||||
|
||||
|
@ -1080,6 +1080,7 @@ void SlObject(void *object, const SaveLoadTable &slt);
|
||||
bool SlObjectMember(void *object, const SaveLoad &sld);
|
||||
|
||||
std::vector<SaveLoad> SlFilterObject(const SaveLoadTable &slt);
|
||||
std::vector<SaveLoad> SlFilterNamedSaveLoadTable(const NamedSaveLoadTable &nslt);
|
||||
void SlObjectSaveFiltered(void *object, const SaveLoadTable &slt);
|
||||
void SlObjectLoadFiltered(void *object, const SaveLoadTable &slt);
|
||||
void SlObjectPtrOrNullFiltered(void *object, const SaveLoadTable &slt);
|
||||
|
Loading…
Reference in New Issue
Block a user