コード例 #1
0
ファイル: cvar.c プロジェクト: ZdrytchX/Lolards
/*
============
Cvar_Command

Handles variable inspection and changing from the console
============
*/
qboolean Cvar_Command( void ) {
	cvar_t	*v;
	char		string[ TRUNCATE_LENGTH ];
	char		resetString[ TRUNCATE_LENGTH ];
	char		latchedString[ TRUNCATE_LENGTH ];

	// check variables
	v = Cvar_FindVar (Cmd_Argv(0));
	if (!v) {
		return qfalse;
	}

	// perform a variable print or set
	if ( Cmd_Argc() == 1 ) {
		Com_TruncateLongString( string, v->string );
		Com_TruncateLongString( resetString, v->resetString );
		Com_Printf ("\"%s\" is:\"%s" S_COLOR_WHITE "\" default:\"%s" S_COLOR_WHITE "\"\n",
				v->name, string, resetString );
		if ( v->latchedString ) {
			Com_TruncateLongString( latchedString, v->latchedString );
			Com_Printf( "latched: \"%s\"\n", latchedString );
		}
		return qtrue;
	}

	// set the value if forcing isn't required
	Cvar_Set2 (v->name, Cmd_Argv(1), qfalse);
	return qtrue;
}
コード例 #2
0
/*
===============
PrintCvarMatches

===============
*/
static void PrintCvarMatches( const char *s ) {
	char value[ TRUNCATE_LENGTH ];

	if ( !Q_stricmpn( s, shortestMatch, strlen( shortestMatch ) ) ) {
		Com_TruncateLongString( value, Cvar_VariableString( s ) );
		Com_Printf( "    %s = \"%s\"\n", s, value );
	}
}
コード例 #3
0
ファイル: common.cpp プロジェクト: Aura15/OpenJK
/*
===============
PrintCvarMatches

===============
*/
static void PrintCvarMatches( const char *s ) {
	char value[TRUNCATE_LENGTH] = {0};

	if ( !Q_stricmpn( s, shortestMatch, (int)strlen( shortestMatch ) ) ) {
		Com_TruncateLongString( value, Cvar_VariableString( s ) );
		Com_Printf( S_COLOR_GREY"Cvar "S_COLOR_WHITE"%s = "S_COLOR_GREY"\""S_COLOR_WHITE"%s"S_COLOR_GREY"\""S_COLOR_WHITE"\n", s, value );
	}
}