mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
add console command to reset a CVAR to default value
Rationale: 1. Now to reset a CVAR to default, the user doesn't need to remember the default value. 2. If a modder wants to reset a CVAR via menu command, they don't need to keep menudef and cvarinfo in sync.
This commit is contained in:
parent
cfbf115c4b
commit
18a8fafd7d
1 changed files with 16 additions and 0 deletions
|
@ -1497,6 +1497,22 @@ CCMD (unset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CCMD (reset)
|
||||||
|
{
|
||||||
|
if (argv.argc() != 2)
|
||||||
|
{
|
||||||
|
Printf ("usage: reset <variable>\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FBaseCVar *var = FindCVar (argv[1], NULL);
|
||||||
|
if (var == NULL)
|
||||||
|
var = new FStringCVar (argv[1], NULL, CVAR_AUTO | CVAR_UNSETTABLE | cvar_defflags);
|
||||||
|
|
||||||
|
var->ResetToDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CCMD (get)
|
CCMD (get)
|
||||||
{
|
{
|
||||||
FBaseCVar *var, *prev;
|
FBaseCVar *var, *prev;
|
||||||
|
|
Loading…
Reference in a new issue