move the old "can't load the level" error to its proper place, added specific error messages for all the times that unarchiving Lua banks can fail

This commit is contained in:
Monster Iestyn 2021-04-26 19:07:11 +01:00
parent 664f5fe5b1
commit 34fa977192
2 changed files with 14 additions and 5 deletions

View file

@ -1567,7 +1567,6 @@ static void CL_LoadReceivedSavegame(boolean reloading)
}
else
{
CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n"));
Z_Free(savebuffer);
save_p = NULL;
if (unlink(tmpsave) == -1)

View file

@ -4190,7 +4190,10 @@ static inline boolean P_NetUnArchiveMisc(boolean reloading)
tokenlist = READUINT32(save_p);
if (!P_LoadLevel(true, reloading))
{
CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n"));
return false;
}
// get the time
leveltime = READUINT32(save_p);
@ -4268,19 +4271,26 @@ static inline boolean P_UnArchiveLuabanksAndConsistency(void)
{
switch (READUINT8(save_p))
{
case 0xb7:
case 0xb7: // luabanks marker
{
UINT8 i, banksinuse = READUINT8(save_p);
if (banksinuse > NUM_LUABANKS)
{
CONS_Alert(CONS_ERROR, M_GetText("Corrupt Luabanks! (Too many banks in use)\n"));
return false;
}
for (i = 0; i < banksinuse; i++)
luabanks[i] = READINT32(save_p);
if (READUINT8(save_p) != 0x1d)
if (READUINT8(save_p) != 0x1d) // consistency marker
{
CONS_Alert(CONS_ERROR, M_GetText("Corrupt Luabanks! (Failed consistency check)\n"));
return false;
}
}
case 0x1d:
case 0x1d: // consistency marker
break;
default:
default: // anything else is nonsense
CONS_Alert(CONS_ERROR, M_GetText("Failed consistency check (???)\n"));
return false;
}