Merge branch 'ghostly-luavars' into 'next'

Fix Luavars being saved into Record Attack ghosts/replays and potentially crashing

See merge request KartKrew/Kart-Public!168
This commit is contained in:
Sal 2020-05-19 17:28:48 -04:00
commit 1d5774fe2f

View file

@ -6368,7 +6368,9 @@ void G_BeginRecording(void)
demoflags |= DF_ENCORE; demoflags |= DF_ENCORE;
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
demoflags |= DF_LUAVARS; if (!modeattacking) // Ghosts don't read luavars, and you shouldn't ever need to save Lua in replays, you doof!
// SERIOUSLY THOUGH WHY WOULD YOU LOAD HOSTMOD AND RECORD A GHOST WITH IT !????
demoflags |= DF_LUAVARS;
#endif #endif
// Setup header. // Setup header.
@ -6474,8 +6476,9 @@ void G_BeginRecording(void)
WRITEUINT8(demo_p, 0xFF); // Denote the end of the player listing WRITEUINT8(demo_p, 0xFF); // Denote the end of the player listing
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
// player lua vars, always saved even if empty // player lua vars, always saved even if empty... Unless it's record attack.
LUA_ArchiveDemo(); if (!modeattacking)
LUA_ArchiveDemo();
#endif #endif
memset(&oldcmd,0,sizeof(oldcmd)); memset(&oldcmd,0,sizeof(oldcmd));
@ -7543,6 +7546,7 @@ void G_DoPlayDemo(char *defdemoname)
if (!gL) // No Lua state! ...I guess we'll just start one... if (!gL) // No Lua state! ...I guess we'll just start one...
LUA_ClearState(); LUA_ClearState();
// No modeattacking check, DF_LUAVARS won't be present here.
LUA_UnArchiveDemo(); LUA_UnArchiveDemo();
} }
#endif #endif