![]() |
![]() |



Author: crusherfred
Date Submitted: 2004-07-16 01:01:45
Downloads: listvar.c
#define SIZE_FOUND_LISTVAR_BUFFER 2048 // size this buffer to your needs
void cvar_ListVars_f(void)
{
if (cmd_Argc() == 2)
{ // additional characters specified, so use for autocomplete input
tchar_t list[SIZE_FOUND_LISTVAR_BUFFER], *s = list;
int count = cvar_AutoComplete(cmd_Argv(1), list, SIZE_FOUND_LISTVAR_BUFFER);
// walk the found cvar list and print
for (;count > 0; --count)
{
cvarhandle_t hvar = cvar_Find(s);
if (hvar)
cvar_Print(hvar);
s += com_strlen(s) + 1;
}
}
else
{ // walk over the list of cvars
int i;
for (i=1; i<cvar_list.size; i++)
cvar_Print(i);
}
}In the console, I always thought it would be nice to type something like "listvars r_" and get a listing of all r_* cvars. This simple replacement for cvar_ListVars_f() allows for cvar listings using the cvar autocomplete function. Try it - you'll like it!
Another solution would be to register a new console command from your app, but I figured this feature would be worth modifying Cipher for.
[Recent Contributions] [Recent Source Code]
User Contributed Comments