engine/host.cpp
bool CheckVarRange_Generic( ConVar *pVar, int minVal, int maxVal )
{
	// Don't reenter (resetting the variable when we're checking the range might cause us to reenter here).
	static bool bInFunction = false;
	if ( bInFunction )	
		return true;
	bInFunction = true;

	if ( !CanCheat() && !Host_IsSinglePlayerGame() )
	{
		int clampedValue = clamp( pVar->GetInt(), minVal, maxVal );
		if ( clampedValue != pVar->GetInt() )
		{
			Warning( "sv_cheats=0 prevented changing %s outside of the range [0,2] (was %d).\n", pVar->GetName(), pVar->GetInt() );
			pVar->SetValue( clampedValue );
		}
	}

	bInFunction = false;
	return false;
}
//-----------------------------------------------------------------------------
// Purpose: Used to set limits on certain convars in multiplayer/sv_cheats mode.
// Returns true if it was called recursively and it early-outed.
//-----------------------------------------------------------------------------
Used to set limits on certain convars in multiplayer/sv_cheats mode.
Returns true if it was called recursively and it early-outed.
Used to set limits on certain convars in multiplayer / sv_cheats mode . Returns true if it was called recursively and it early - outed .
bool CheckVarRange_Generic( ConVar *pVar, int minVal, int maxVal )
{
	static bool bInFunction = false;
	if ( bInFunction )	
		return true;
	bInFunction = true;
	if ( !CanCheat() && !Host_IsSinglePlayerGame() )
	{
		int clampedValue = clamp( pVar->GetInt(), minVal, maxVal );
		if ( clampedValue != pVar->GetInt() )
		{
			Warning( "sv_cheats=0 prevented changing %s outside of the range [0,2] (was %d).\n", pVar->GetName(), pVar->GetInt() );
			pVar->SetValue( clampedValue );
		}
	}
	bInFunction = false;
	return false;
}
bool CheckVarRange_Generic ( ConVar * pVar , int minVal , int maxVal ) { static bool bInFunction = false ; if ( bInFunction ) return true ; bInFunction = true ; if ( ! CanCheat ( ) && ! Host_IsSinglePlayerGame ( ) ) { int clampedValue = clamp ( pVar -> GetInt ( ) , minVal , maxVal ) ; if ( clampedValue != pVar -> GetInt ( ) ) { Warning ( " \n " , pVar -> GetName ( ) , pVar -> GetInt ( ) ) ; pVar -> SetValue ( clampedValue ) ; } } bInFunction = false ; return false ; }
Purpose: Used to set limits on certain convars in multiplayer/sv_cheats mode.
Purpose : Used to set limits on certain convars in multiplayer / sv_cheats mode .
// Don't reenter (resetting the variable when we're checking the range might cause us to reenter here).