- uncoupled the decompressors from ZDoom's internal error handling.

This code made it hard to repurpose this code for other tools, so now the error handler must be passed as a callback to OpenDecompressor.
This commit is contained in:
Christoph Oelckers 2019-08-20 22:34:35 +02:00
commit 0abc66dbff
10 changed files with 115 additions and 68 deletions

View file

@ -728,13 +728,21 @@ bool MapLoader::LoadExtendedNodes (FileReader &dalump, uint32_t id)
if (compressed)
{
FileReader zip;
if (zip.OpenDecompressor(dalump, -1, METHOD_ZLIB, false))
try
{
LoadZNodes(zip, type);
if (zip.OpenDecompressor(dalump, -1, METHOD_ZLIB, false, [](const char* err) { I_Error("%s", err); }))
{
LoadZNodes(zip, type);
}
else
{
Printf("Error loading nodes: Corrupt data.\n");
return false;
}
}
else
catch (const CRecoverableError& err)
{
Printf("Error loading nodes: Corrupt data.\n");
Printf("Error loading nodes: %s.\n", err.what());
return false;
}
}