=================== CL_GetServerCommand Set up argc/argv for the given command =================== */
| 345 | =================== |
| 346 | */ |
| 347 | qboolean CL_GetServerCommand( int serverCommandNumber ) { |
| 348 | char *s; |
| 349 | const char *cmd; |
| 350 | |
| 351 | // if we have irretrievably lost a reliable command, drop the connection |
| 352 | if ( serverCommandNumber <= clc.serverCommandSequence - MAX_RELIABLE_COMMANDS ) { |
| 353 | Com_Error( ERR_DROP, "CL_GetServerCommand: a reliable command was cycled out" ); |
| 354 | return qfalse; |
| 355 | } |
| 356 | |
| 357 | if ( serverCommandNumber > clc.serverCommandSequence ) { |
| 358 | Com_Error( ERR_DROP, "CL_GetServerCommand: requested a command not received" ); |
| 359 | return qfalse; |
| 360 | } |
| 361 | |
| 362 | s = clc.serverCommands[ serverCommandNumber & ( MAX_RELIABLE_COMMANDS - 1 ) ]; |
| 363 | |
| 364 | Com_DPrintf( "serverCommand: %i : %s\n", serverCommandNumber, s ); |
| 365 | |
| 366 | Cmd_TokenizeString( s ); |
| 367 | cmd = Cmd_Argv(0); |
| 368 | |
| 369 | if ( !strcmp( cmd, "disconnect" ) ) { |
| 370 | Com_Error (ERR_DISCONNECT,"Server disconnected\n"); |
| 371 | } |
| 372 | |
| 373 | if ( !strcmp( cmd, "cs" ) ) { |
| 374 | CL_ConfigstringModified(); |
| 375 | // reparse the string, because CL_ConfigstringModified may have done another Cmd_TokenizeString() |
| 376 | Cmd_TokenizeString( s ); |
| 377 | return qtrue; |
| 378 | } |
| 379 | |
| 380 | // the clientLevelShot command is used during development |
| 381 | // to generate 128*128 screenshots from the intermission |
| 382 | // point of levels for the menu system to use |
| 383 | // we pass it along to the cgame to make apropriate adjustments, |
| 384 | // but we also clear the console and notify lines here |
| 385 | if ( !strcmp( cmd, "clientLevelShot" ) ) { |
| 386 | // don't do it if we aren't running the server locally, |
| 387 | // otherwise malicious remote servers could overwrite |
| 388 | // the existing thumbnails |
| 389 | if ( !com_sv_running->integer ) { |
| 390 | return qfalse; |
| 391 | } |
| 392 | // close the console |
| 393 | Con_Close(); |
| 394 | // take a special screenshot next frame |
| 395 | Cbuf_AddText( "wait ; wait ; wait ; wait ; screenshot levelshot\n" ); |
| 396 | return qtrue; |
| 397 | } |
| 398 | |
| 399 | // we may want to put a "connect to other server" command here |
| 400 | |
| 401 | // cgame can now act on the command |
| 402 | return qtrue; |
| 403 | } |
| 404 |
no test coverage detected