From 660be5cc7d3989740b4e6fbd8ed8b1d9c46ebd20 Mon Sep 17 00:00:00 2001 From: tma Date: Tue, 16 Sep 2008 21:05:22 +0000 Subject: * 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 --- code/qcommon/cvar.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'code/qcommon/cvar.c') 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 " " + 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); } -- cgit v1.2.3