did some cleanup of the FResourceFile interface.

* making all members protected (but adding friend overrides for the classes which still need it)
* allowing to read data without retrieving the FResourceLump object.
This commit is contained in:
Christoph Oelckers 2023-12-10 10:22:07 +01:00
commit ebc808e2a9
12 changed files with 128 additions and 92 deletions

View file

@ -2004,32 +2004,28 @@ void G_ReadSnapshots(FResourceFile *resf)
G_ClearSnapshots();
for (unsigned j = 0; j < resf->LumpCount(); j++)
for (unsigned j = 0; j < resf->EntryCount(); j++)
{
auto resl = resf->GetLump(j);
if (resl != nullptr)
auto name = resf->getName(j);
auto ptr = strstr(name, ".map.json");
if (ptr != nullptr)
{
auto name = resl->getName();
auto ptr = strstr(name, ".map.json");
ptrdiff_t maplen = ptr - name;
FString mapname(name, (size_t)maplen);
i = FindLevelInfo(mapname.GetChars());
if (i != nullptr)
{
i->Snapshot = resf->GetRawData(j);
}
}
else
{
auto ptr = strstr(name, ".mapd.json");
if (ptr != nullptr)
{
ptrdiff_t maplen = ptr - name;
FString mapname(name, (size_t)maplen);
i = FindLevelInfo(mapname.GetChars());
if (i != nullptr)
{
i->Snapshot = resl->GetRawData();
}
}
else
{
auto ptr = strstr(name, ".mapd.json");
if (ptr != nullptr)
{
ptrdiff_t maplen = ptr - name;
FString mapname(name, (size_t)maplen);
TheDefaultLevelInfo.Snapshot = resl->GetRawData();
}
TheDefaultLevelInfo.Snapshot = resf->GetRawData(j);
}
}
}