mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-29 20:50:38 +00:00
Add some checks against invalid replays
This commit is contained in:
parent
b135c46d60
commit
402796b3c6
1 changed files with 44 additions and 3 deletions
47
src/g_game.c
47
src/g_game.c
|
@ -6630,7 +6630,8 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
break;
|
break;
|
||||||
#ifdef DEMO_COMPAT_100
|
#ifdef DEMO_COMPAT_100
|
||||||
case 0x0001:
|
case 0x0001:
|
||||||
I_Error("You need to implement demo compat here, doofus! %s:%d", __FILE__, __LINE__);
|
CONS_Printf("You need to implement demo compat here, doofus! %s:%d\n", __FILE__, __LINE__);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
// too old, cannot support.
|
// too old, cannot support.
|
||||||
default:
|
default:
|
||||||
|
@ -6661,7 +6662,21 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
|
|
||||||
demoflags = READUINT8(demo_p);
|
demoflags = READUINT8(demo_p);
|
||||||
#ifdef DEMO_COMPAT_100
|
#ifdef DEMO_COMPAT_100
|
||||||
if (demoversion != 0x0001)
|
if (demoversion == 0x0001)
|
||||||
|
{
|
||||||
|
if (demoflags & DF_MULTIPLAYER)
|
||||||
|
{
|
||||||
|
snprintf(msg, 1024, M_GetText("%s is an alpha multiplayer replay and cannot be played.\n"), pdemoname);
|
||||||
|
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||||
|
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||||
|
Z_Free(pdemoname);
|
||||||
|
Z_Free(demobuffer);
|
||||||
|
demoplayback = false;
|
||||||
|
titledemo = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
gametype = READUINT8(demo_p);
|
gametype = READUINT8(demo_p);
|
||||||
|
@ -6902,12 +6917,38 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
while (p != 0xFF)
|
while (p != 0xFF)
|
||||||
{
|
{
|
||||||
spectator = false;
|
spectator = false;
|
||||||
if (p & DEMO_SPECTATOR) {
|
if (p & DEMO_SPECTATOR)
|
||||||
|
{
|
||||||
spectator = true;
|
spectator = true;
|
||||||
p &= ~DEMO_SPECTATOR;
|
p &= ~DEMO_SPECTATOR;
|
||||||
|
|
||||||
|
if (modeattacking)
|
||||||
|
{
|
||||||
|
snprintf(msg, 1024, M_GetText("%s is a record attack replay with spectators, and is thus invalid.\n"), pdemoname);
|
||||||
|
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||||
|
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||||
|
Z_Free(pdemoname);
|
||||||
|
Z_Free(demobuffer);
|
||||||
|
demoplayback = false;
|
||||||
|
titledemo = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
slots[numslots] = p; numslots++;
|
slots[numslots] = p; numslots++;
|
||||||
|
|
||||||
|
|
||||||
|
if (modeattacking && numslots > 1)
|
||||||
|
{
|
||||||
|
snprintf(msg, 1024, M_GetText("%s is a record attack replay with multiple players, and is thus invalid.\n"), pdemoname);
|
||||||
|
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||||
|
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||||
|
Z_Free(pdemoname);
|
||||||
|
Z_Free(demobuffer);
|
||||||
|
demoplayback = false;
|
||||||
|
titledemo = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!playeringame[displayplayer] || players[displayplayer].spectator)
|
if (!playeringame[displayplayer] || players[displayplayer].spectator)
|
||||||
displayplayer = consoleplayer = serverplayer = p;
|
displayplayer = consoleplayer = serverplayer = p;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue