summaryrefslogtreecommitdiff
path: root/engine/cvar.h
blob: 8bd8978a4b3e8f854b42e53b51344ee5b589649e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//
//===========================================================================//

#if !defined( CVAR_H )
#define CVAR_H
#ifdef _WIN32
#pragma once
#endif


//-----------------------------------------------------------------------------
// Forward declarations 
//-----------------------------------------------------------------------------
class ConVar;
class ConCommandBase;
class CCommand;
class CUtlBuffer;


//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
class CCvarUtilities
{
public:
	bool IsCommand( const CCommand &args );

	// Writes lines containing "set variable value" for all variables
	// with the archive flag set to true.
	void WriteVariables( CUtlBuffer &buff, bool bAllVars );

	// Returns the # of cvars with the server flag set.
	int	CountVariablesWithFlags( int flags );

	// Lists cvars to console
	void CvarList( const CCommand &args );

	// Prints help text for cvar
	void CvarHelp( const CCommand &args );

	// Revert all cvar values
	void CvarRevert( const CCommand &args );

	// Revert all cvar values
	void CvarDifferences( const CCommand &args );

	// Toggles a cvar on/off, or cycles through a set of values
	void CvarToggle( const CCommand &args );

	// Finds commands with a specified flag.
	void CvarFindFlags_f( const CCommand &args );

private:
	// just like Cvar_set, but optimizes out the search
	void SetDirect( ConVar *var, const char *value );

	bool IsValidToggleCommand( const char *cmd );
};

extern CCvarUtilities *cv;


#endif // CVAR_H