Fix the actual problem with saving in DEVELOP: cv_cheats didn't have CV_NOINIT

Also fixes a likely waiting-in-the-wings crash for the next time we make a non-DEVELOP build.
This commit is contained in:
toaster 2022-11-28 19:21:02 +00:00
parent 6d0637d39d
commit b074d6cbdd
2 changed files with 9 additions and 10 deletions

View file

@ -84,7 +84,7 @@ CV_PossibleValue_t CV_Natural[] = {{1, "MIN"}, {999999999, "MAX"}, {0, NULL}};
#else
#define VALUE "Off"
#endif
consvar_t cv_cheats = CVAR_INIT ("cheats", VALUE, CV_NETVAR|CV_CALL, CV_OnOff, CV_CheatsChanged);
consvar_t cv_cheats = CVAR_INIT ("cheats", VALUE, CV_NETVAR|CV_CALL|CV_NOINIT, CV_OnOff, CV_CheatsChanged);
#undef VALUE
// SRB2kart

View file

@ -4501,6 +4501,14 @@ void G_SaveGameData(void)
if (!gamedataloaded)
return; // If never loaded (-nodata), don't save
if (usedCheats)
{
#ifdef DEVELOP
CONS_Alert(CONS_WARNING, M_GetText("Cheats used - Gamedata will not be saved.\n"));
#endif
return;
}
length = (4+4+4+1+(MAXEMBLEMS)+MAXEXTRAEMBLEMS+MAXUNLOCKABLES+MAXCONDITIONSETS+4+4);
length += nummapheaders * (MAXMAPLUMPNAME+1+4+4);
@ -4511,15 +4519,6 @@ void G_SaveGameData(void)
return;
}
#ifndef DEVELOP
if (usedCheats)
{
free(savebuffer);
save_p = savebuffer = NULL;
return;
}
#endif
// Version test
WRITEUINT32(save_p, GD_VERSIONCHECK); // 4