diff options
author | Zack Middleton <zturtleman@gmail.com> | 2013-12-01 23:16:51 -0600 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2015-03-17 11:37:26 +0000 |
commit | e5ccbe44258411a4cdbe05951a58dd575b800056 (patch) | |
tree | 7a72f1793882cfa45fe4680a5308b5a141588f74 | |
parent | d4b6325630fc85b3a36aa3761b9617b7eaeb16fd (diff) |
Add cvar_modified command
Based on cvarlist command, it only lists modified cvars.
-rw-r--r-- | src/qcommon/cvar.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/src/qcommon/cvar.c b/src/qcommon/cvar.c index 84d6ac5a..93ab6ae8 100644 --- a/src/qcommon/cvar.c +++ b/src/qcommon/cvar.c @@ -1019,6 +1019,90 @@ void Cvar_List_f( void ) { /* ============ +Cvar_ListModified_f +============ +*/ +void Cvar_ListModified_f( void ) { + cvar_t *var; + int totalModified; + char *value; + char *match; + + if ( Cmd_Argc() > 1 ) { + match = Cmd_Argv( 1 ); + } else { + match = NULL; + } + + totalModified = 0; + for (var = cvar_vars ; var ; var = var->next) + { + if ( !var->name || !var->modificationCount ) + continue; + + value = var->latchedString ? var->latchedString : var->string; + if ( !strcmp( value, var->resetString ) ) + continue; + + totalModified++; + + if (match && !Com_Filter(match, var->name, qfalse)) + continue; + + if (var->flags & CVAR_SERVERINFO) { + Com_Printf("S"); + } else { + Com_Printf(" "); + } + if (var->flags & CVAR_SYSTEMINFO) { + Com_Printf("s"); + } else { + Com_Printf(" "); + } + if (var->flags & CVAR_USERINFO) { + Com_Printf("U"); + } else { + Com_Printf(" "); + } + if (var->flags & CVAR_ROM) { + Com_Printf("R"); + } else { + Com_Printf(" "); + } + if (var->flags & CVAR_INIT) { + Com_Printf("I"); + } else { + Com_Printf(" "); + } + if (var->flags & CVAR_ARCHIVE) { + Com_Printf("A"); + } else { + Com_Printf(" "); + } + if (var->flags & CVAR_LATCH) { + Com_Printf("L"); + } else { + Com_Printf(" "); + } + if (var->flags & CVAR_CHEAT) { + Com_Printf("C"); + } else { + Com_Printf(" "); + } + if (var->flags & CVAR_USER_CREATED) { + Com_Printf("?"); + } else { + Com_Printf(" "); + } + + Com_Printf (" %s \"%s\", default \"%s\"\n", var->name, value, var->resetString); + } + + Com_Printf ("\n%i total modified cvars\n", totalModified); +} + +/* +============ Cvar_Unset Unsets a cvar @@ -1320,5 +1404,6 @@ void Cvar_Init (void) Cmd_SetCommandCompletionFunc("unset", Cvar_CompleteCvarName); Cmd_AddCommand ("cvarlist", Cvar_List_f); + Cmd_AddCommand ("cvar_modified", Cvar_ListModified_f); Cmd_AddCommand ("cvar_restart", Cvar_Restart_f); } |