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

Function Cvar_Command

code/qcommon/cvar.cpp:789–816  ·  view source on GitHub ↗

============ Cvar_Command Handles variable inspection and changing from the console ============ */

Source from the content-addressed store, hash-verified

787============
788*/
789qboolean 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============

Callers 1

Cmd_ExecuteStringFunction · 0.70

Calls 7

Cvar_SetValue2Function · 0.85
Cvar_FindVarFunction · 0.70
Cmd_ArgvFunction · 0.70
Cmd_ArgcFunction · 0.70
Cvar_PrintFunction · 0.70
Cvar_Set2Function · 0.70
Cmd_ArgsFunction · 0.70

Tested by

no test coverage detected