summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/client.txt3
-rw-r--r--src/common/cvar.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/doc/client.txt b/doc/client.txt
index 6331ae7..b5eaaa3 100644
--- a/doc/client.txt
+++ b/doc/client.txt
@@ -1128,6 +1128,9 @@ dec <cvar> [value]::
reset <cvar>::
Reset the specified _cvar_ to it's default value.
+resetall::
+ Resets all cvars to their default values.
+
set <cvar> <value> [u|s|...]::
If 2 arguments are given, sets the specified _cvar_ to _value_. If 3
arguments are given, and the last argument is ā€˜u’ or ā€˜s’, sets _cvar_ to
diff --git a/src/common/cvar.c b/src/common/cvar.c
index d429aaf..065ee8e 100644
--- a/src/common/cvar.c
+++ b/src/common/cvar.c
@@ -1091,6 +1091,19 @@ static void Cvar_Reset_c(genctx_t *ctx, int argnum)
}
}
+static void Cvar_ResetAll_f(void)
+{
+ cvar_t *var;
+
+ for (var = cvar_vars; var; var = var->next) {
+ if (var->flags & CVAR_ROM)
+ continue;
+ if ((var->flags & CVAR_NOSET) && com_initialized)
+ continue;
+ Cvar_SetByVar(var, var->default_string, Cmd_From());
+ }
+}
+
size_t Cvar_BitInfo(char *info, int bit)
{
char newi[MAX_INFO_STRING], *v;
@@ -1141,6 +1154,7 @@ static const cmdreg_t c_cvar[] = {
{ "inc", Cvar_Inc_f, Cvar_Reset_c },
{ "dec", Cvar_Inc_f, Cvar_Reset_c },
{ "reset", Cvar_Reset_f, Cvar_Reset_c },
+ { "resetall", Cvar_ResetAll_f },
{ NULL }
};