Added cheat flag for console variables

CVAR with this flag can be set in console or from command line when sv_cheats is enabled
There is no such restriction for changing its value from ACS, via SetCVar() and related functions
'cheat' modifier can be used in CVARINFO lump to create variable of this kind
This commit is contained in:
alexey.lysiuk 2017-01-31 11:05:29 +02:00 committed by Christoph Oelckers
commit 6225f60eb2
3 changed files with 13 additions and 0 deletions

View file

@ -1617,8 +1617,16 @@ void C_ArchiveCVars (FConfigFile *f, uint32 filter)
}
}
EXTERN_CVAR(Bool, sv_cheats);
void FBaseCVar::CmdSet (const char *newval)
{
if ((GetFlags() & CVAR_CHEAT) && !sv_cheats)
{
Printf("sv_cheats must be true to set this console variable.\n");
return;
}
UCVarValue val;
// Casting away the const is safe in this case.