mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
Fixed resetting CVARs via internal menu CCMDs
This restores functionality of reset to defaults/saved menu options
This commit is contained in:
parent
d9323b9740
commit
35508bc8fb
1 changed files with 19 additions and 5 deletions
|
@ -157,11 +157,6 @@ void FBaseCVar::SetGenericRep (UCVarValue value, ECVarType type)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (UnsafeExecutionContext && !(GetFlags() & CVAR_MOD))
|
|
||||||
{
|
|
||||||
Printf(TEXTCOLOR_RED "Cannot set console variable" TEXTCOLOR_GOLD " %s " TEXTCOLOR_RED "from unsafe command\n", GetName());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if ((Flags & CVAR_LATCH) && gamestate != GS_FULLCONSOLE && gamestate != GS_STARTUP)
|
else if ((Flags & CVAR_LATCH) && gamestate != GS_FULLCONSOLE && gamestate != GS_STARTUP)
|
||||||
{
|
{
|
||||||
FLatchedValue latch;
|
FLatchedValue latch;
|
||||||
|
@ -1712,6 +1707,16 @@ void C_ArchiveCVars (FConfigFile *f, uint32_t filter)
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, sv_cheats);
|
EXTERN_CVAR(Bool, sv_cheats);
|
||||||
|
|
||||||
|
static bool IsUnsafe(const FBaseCVar *const var)
|
||||||
|
{
|
||||||
|
const bool unsafe = UnsafeExecutionContext && !(var->GetFlags() & CVAR_MOD);
|
||||||
|
if (unsafe)
|
||||||
|
{
|
||||||
|
Printf(TEXTCOLOR_RED "Cannot set console variable" TEXTCOLOR_GOLD " %s " TEXTCOLOR_RED "from unsafe command\n", var->GetName());
|
||||||
|
}
|
||||||
|
return unsafe;
|
||||||
|
}
|
||||||
|
|
||||||
void FBaseCVar::CmdSet (const char *newval)
|
void FBaseCVar::CmdSet (const char *newval)
|
||||||
{
|
{
|
||||||
if ((GetFlags() & CVAR_CHEAT) && !sv_cheats)
|
if ((GetFlags() & CVAR_CHEAT) && !sv_cheats)
|
||||||
|
@ -1719,6 +1724,10 @@ void FBaseCVar::CmdSet (const char *newval)
|
||||||
Printf("sv_cheats must be true to set this console variable.\n");
|
Printf("sv_cheats must be true to set this console variable.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (IsUnsafe(this))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UCVarValue val;
|
UCVarValue val;
|
||||||
|
|
||||||
|
@ -1805,6 +1814,11 @@ CCMD (toggle)
|
||||||
{
|
{
|
||||||
if ( (var = FindCVar (argv[1], &prev)) )
|
if ( (var = FindCVar (argv[1], &prev)) )
|
||||||
{
|
{
|
||||||
|
if (IsUnsafe(var))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
val = var->GetGenericRep (CVAR_Bool);
|
val = var->GetGenericRep (CVAR_Bool);
|
||||||
val.Bool = !val.Bool;
|
val.Bool = !val.Bool;
|
||||||
var->SetGenericRep (val, CVAR_Bool);
|
var->SetGenericRep (val, CVAR_Bool);
|
||||||
|
|
Loading…
Reference in a new issue