aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon/cvar.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-09-16 21:05:22 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-09-16 21:05:22 +0000
commit660be5cc7d3989740b4e6fbd8ed8b1d9c46ebd20 (patch)
treec609227c4de7d3ea10310714c3262d58665b3ffa /code/qcommon/cvar.c
parent134e4522a3a9eb3f3e2f8e3646eb3d3999d49694 (diff)
downloadioquake3-aero-660be5cc7d3989740b4e6fbd8ed8b1d9c46ebd20.tar.gz
ioquake3-aero-660be5cc7d3989740b4e6fbd8ed8b1d9c46ebd20.zip
* Move command argument completion from being hard coded to being associated
with the individual commands to be completed git-svn-id: svn://svn.icculus.org/quake3/trunk@1472 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon/cvar.c')
-rw-r--r--code/qcommon/cvar.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/code/qcommon/cvar.c b/code/qcommon/cvar.c
index fc2a9fa..6f6092b 100644
--- a/code/qcommon/cvar.c
+++ b/code/qcommon/cvar.c
@@ -1055,6 +1055,22 @@ void Cvar_Update( vmCvar_t *vmCvar ) {
vmCvar->integer = cv->integer;
}
+/*
+==================
+Cvar_CompleteCvarName
+==================
+*/
+void Cvar_CompleteCvarName( char *args, int argNum )
+{
+ if( argNum == 2 )
+ {
+ // Skip "<cmd> "
+ char *p = Com_SkipTokens( args, 1, " " );
+
+ if( p > args )
+ Field_CompleteCommand( p, qfalse, qtrue );
+ }
+}
/*
============
@@ -1068,11 +1084,17 @@ void Cvar_Init (void) {
Cmd_AddCommand ("print", Cvar_Print_f);
Cmd_AddCommand ("toggle", Cvar_Toggle_f);
+ Cmd_SetCommandCompletionFunc( "toggle", Cvar_CompleteCvarName );
Cmd_AddCommand ("set", Cvar_Set_f);
+ Cmd_SetCommandCompletionFunc( "set", Cvar_CompleteCvarName );
Cmd_AddCommand ("sets", Cvar_Set_f);
+ Cmd_SetCommandCompletionFunc( "sets", Cvar_CompleteCvarName );
Cmd_AddCommand ("setu", Cvar_Set_f);
+ Cmd_SetCommandCompletionFunc( "setu", Cvar_CompleteCvarName );
Cmd_AddCommand ("seta", Cvar_Set_f);
+ Cmd_SetCommandCompletionFunc( "seta", Cvar_CompleteCvarName );
Cmd_AddCommand ("reset", Cvar_Reset_f);
+ Cmd_SetCommandCompletionFunc( "reset", Cvar_CompleteCvarName );
Cmd_AddCommand ("cvarlist", Cvar_List_f);
Cmd_AddCommand ("cvar_restart", Cvar_Restart_f);
}