============ idCmdSystemLocal::ExecuteTokenizedString ============ */
| 470 | ============ |
| 471 | */ |
| 472 | void idCmdSystemLocal::ExecuteTokenizedString( const idCmdArgs &args ) { |
| 473 | commandDef_t *cmd, **prev; |
| 474 | |
| 475 | // execute the command line |
| 476 | if ( !args.Argc() ) { |
| 477 | return; // no tokens |
| 478 | } |
| 479 | |
| 480 | // check registered command functions |
| 481 | for ( prev = &commands; *prev; prev = &cmd->next ) { |
| 482 | cmd = *prev; |
| 483 | if ( idStr::Icmp( args.Argv( 0 ), cmd->name ) == 0 ) { |
| 484 | // rearrange the links so that the command will be |
| 485 | // near the head of the list next time it is used |
| 486 | *prev = cmd->next; |
| 487 | cmd->next = commands; |
| 488 | commands = cmd; |
| 489 | |
| 490 | if ( ( cmd->flags & (CMD_FL_CHEAT|CMD_FL_TOOL) ) && session && session->IsMultiplayer() && !cvarSystem->GetCVarBool( "net_allowCheats" ) ) { |
| 491 | common->Printf( "Command '%s' not valid in multiplayer mode.\n", cmd->name ); |
| 492 | return; |
| 493 | } |
| 494 | // perform the action |
| 495 | if ( !cmd->function ) { |
| 496 | break; |
| 497 | } else { |
| 498 | cmd->function( args ); |
| 499 | } |
| 500 | return; |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | // check cvars |
| 505 | if ( cvarSystem->Command( args ) ) { |
| 506 | return; |
| 507 | } |
| 508 | |
| 509 | common->Printf( "Unknown command '%s'\n", args.Argv( 0 ) ); |
| 510 | } |
| 511 | |
| 512 | /* |
| 513 | ============ |
nothing calls this directly
no test coverage detected