MCPcopy Create free account
hub / github.com/JACoders/OpenJK / CL_ForwardCommandToServer

Function CL_ForwardCommandToServer

code/client/cl_main.cpp:298–321  ·  view source on GitHub ↗

=================== CL_ForwardCommandToServer adds the current command line as a clientCommand things like godmode, noclip, etc, are commands directed to the server, so when they are typed in at the console, they will need to be forwarded. =================== */

Source from the content-addressed store, hash-verified

296===================
297*/
298void CL_ForwardCommandToServer( void ) {
299 const char *cmd;
300 char string[MAX_STRING_CHARS];
301
302 cmd = Cmd_Argv(0);
303
304 // ignore key up commands
305 if ( cmd[0] == '-' ) {
306 return;
307 }
308
309 if ( cls.state != CA_ACTIVE || cmd[0] == '+' ) {
310 Com_Printf ("Unknown command \"%s\"\n", cmd);
311 return;
312 }
313
314 if ( Cmd_Argc() > 1 ) {
315 Com_sprintf( string, sizeof(string), "%s %s", cmd, Cmd_Args() );
316 } else {
317 Q_strncpyz( string, cmd, sizeof(string) );
318 }
319
320 CL_AddReliableCommand( string );
321}
322
323
324/*

Callers 1

Cmd_ExecuteStringFunction · 0.50

Calls 7

Q_strncpyzFunction · 0.85
CL_AddReliableCommandFunction · 0.70
Cmd_ArgvFunction · 0.50
Com_PrintfFunction · 0.50
Cmd_ArgcFunction · 0.50
Com_sprintfFunction · 0.50
Cmd_ArgsFunction · 0.50

Tested by

no test coverage detected