Merge branch 'load-netgame-error-fixes' into 'next'

Load netgame error fixes

See merge request STJr/SRB2!1482
This commit is contained in:
Monster Iestyn 2021-05-07 17:27:19 -04:00
commit fa140c1eb3
2 changed files with 14 additions and 8 deletions

View file

@ -1565,10 +1565,6 @@ static void CL_LoadReceivedSavegame(boolean reloading)
}
CONS_Printf("\"\n");
}
else
{
CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n"));
}
// done
Z_Free(savebuffer);

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;
}