make nosave standalone CVar flag, alongside server and user

This commit is contained in:
Alexander Kromm 2020-01-16 22:48:18 +07:00 committed by Christoph Oelckers
commit 7973ab9c6b
4 changed files with 47 additions and 35 deletions

View file

@ -1479,7 +1479,7 @@ void ParseCVarInfo()
}
else if (stricmp(sc.String, "nosave") == 0)
{
cvarflags |= CVAR_NOSAVEGAME;
cvarflags |= CVAR_CONFIG_ONLY;
}
else
{
@ -1487,11 +1487,22 @@ void ParseCVarInfo()
}
sc.MustGetAnyToken();
}
// Possibility of defining a cvar as 'server nosave' or 'user nosave' is kept for
// compatibility reasons.
if (cvarflags & CVAR_CONFIG_ONLY)
{
cvarflags &= ~CVAR_SERVERINFO;
cvarflags &= ~CVAR_USERINFO;
}
// Do some sanity checks.
if ((cvarflags & (CVAR_SERVERINFO|CVAR_USERINFO)) == 0 ||
// No need to check server-nosave and user-nosave combinations because they
// are made impossible right above.
if ((cvarflags & (CVAR_SERVERINFO|CVAR_USERINFO|CVAR_CONFIG_ONLY)) == 0 ||
(cvarflags & (CVAR_SERVERINFO|CVAR_USERINFO)) == (CVAR_SERVERINFO|CVAR_USERINFO))
{
sc.ScriptError("One of 'server' or 'user' must be specified");
sc.ScriptError("One of 'server', 'user', or 'nosave' must be specified");
}
// The next token must be the cvar type.
if (sc.TokenType == TK_Bool)