mirror of
https://github.com/ioquake/ioq3.git
synced 2025-05-30 16:41:31 +00:00
* Move command argument completion from being hard coded to being associated
with the individual commands to be completed
This commit is contained in:
parent
47ee177430
commit
130c0c6575
8 changed files with 195 additions and 89 deletions
|
@ -870,6 +870,22 @@ static void CL_WalkDemoExt(char *arg, char *name, int *demofile)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_CompleteDemoName
|
||||
====================
|
||||
*/
|
||||
static void CL_CompleteDemoName( char *args, int argNum )
|
||||
{
|
||||
if( argNum == 2 )
|
||||
{
|
||||
char demoExt[ 16 ];
|
||||
|
||||
Com_sprintf( demoExt, sizeof( demoExt ), ".dm_%d", PROTOCOL_VERSION );
|
||||
Field_CompleteFilename( "demos", demoExt, qtrue );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_PlayDemo_f
|
||||
|
@ -1565,6 +1581,23 @@ void CL_Connect_f( void ) {
|
|||
|
||||
#define MAX_RCON_MESSAGE 1024
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_CompleteRcon
|
||||
==================
|
||||
*/
|
||||
static void CL_CompleteRcon( char *args, int argNum )
|
||||
{
|
||||
if( argNum == 2 )
|
||||
{
|
||||
// Skip "rcon "
|
||||
char *p = Com_SkipTokens( args, 1, " " );
|
||||
|
||||
if( p > args )
|
||||
Field_CompleteCommand( p, qtrue, qtrue );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_Rcon_f
|
||||
|
@ -3150,6 +3183,7 @@ void CL_Init( void ) {
|
|||
Cmd_AddCommand ("disconnect", CL_Disconnect_f);
|
||||
Cmd_AddCommand ("record", CL_Record_f);
|
||||
Cmd_AddCommand ("demo", CL_PlayDemo_f);
|
||||
Cmd_SetCommandCompletionFunc( "demo", CL_CompleteDemoName );
|
||||
Cmd_AddCommand ("cinematic", CL_PlayCinematic_f);
|
||||
Cmd_AddCommand ("stoprecord", CL_StopRecord_f);
|
||||
Cmd_AddCommand ("connect", CL_Connect_f);
|
||||
|
@ -3157,6 +3191,7 @@ void CL_Init( void ) {
|
|||
Cmd_AddCommand ("localservers", CL_LocalServers_f);
|
||||
Cmd_AddCommand ("globalservers", CL_GlobalServers_f);
|
||||
Cmd_AddCommand ("rcon", CL_Rcon_f);
|
||||
Cmd_SetCommandCompletionFunc( "rcon", CL_CompleteRcon );
|
||||
Cmd_AddCommand ("setenv", CL_Setenv_f );
|
||||
Cmd_AddCommand ("ping", CL_Ping_f );
|
||||
Cmd_AddCommand ("serverstatus", CL_ServerStatus_f );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue