============ Cvar_Command Handles variable inspection and changing from the console ============ */
| 787 | ============ |
| 788 | */ |
| 789 | qboolean Cvar_Command( void ) { |
| 790 | cvar_t *v; |
| 791 | |
| 792 | // check variables |
| 793 | v = Cvar_FindVar (Cmd_Argv(0)); |
| 794 | if (!v) { |
| 795 | return qfalse; |
| 796 | } |
| 797 | |
| 798 | // perform a variable print or set |
| 799 | if ( Cmd_Argc() == 1 ) { |
| 800 | Cvar_Print( v ); |
| 801 | return qtrue; |
| 802 | } |
| 803 | |
| 804 | // toggle |
| 805 | if( !strcmp( Cmd_Argv(1), "!" ) ) |
| 806 | { |
| 807 | // Swap the value if our command has ! in it (bind p "cg_thirdPeson !") |
| 808 | Cvar_SetValue2( v->name, !v->value, qfalse ); |
| 809 | return qtrue; |
| 810 | } |
| 811 | |
| 812 | // set the value if forcing isn't required |
| 813 | Cvar_Set2 (v->name, Cmd_Args(), qfalse); |
| 814 | |
| 815 | return qtrue; |
| 816 | } |
| 817 | |
| 818 | /* |
| 819 | ============ |
no test coverage detected