37 #include "../shared/shared.h"
38 #include "../common/scripts_lua.h"
40 #define CVAR_ARCHIVE 1
41 #define CVAR_USERINFO 2
42 #define CVAR_SERVERINFO 4
45 #define CVAR_DEVELOPER 32
47 #define CVAR_R_IMAGES 128
48 #define CVAR_R_CONTEXT 256
49 #define CVAR_R_PROGRAMS 512
51 #define CVAR_R_MASK (CVAR_R_IMAGES | CVAR_R_CONTEXT | CVAR_R_PROGRAMS)
117 cvar_t*
Cvar_Get(
const char* varName,
const char* value =
"",
int flags = 0,
const char* desc =
nullptr);
259 void Cvar_PrintDebugCvars(
void);
struct cvar_s cvar_t
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
cvar_t cvar_t * Cvar_ForceSet(const char *varName, const char *value)
will set the variable even if NOSET or LATCH
void Com_SetUserinfoModified(bool modified)
struct cvar_s * hash_next
cvar_t * Cvar_FindVar(const char *varName)
Searches for a cvar given by parameter.
void Cvar_SetValue(const char *varName, float value)
expands value to a string and calls Cvar_Set
bool Cvar_Command(void)
called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known command. Returns true if the comma...
cvar_t * Cvar_Set(const char *varName, const char *value,...) __attribute__((format(__printf__
will create the variable if it doesn't exist
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
const char * Cvar_VariableStringOld(const char *varName)
returns an empty string if not defined
float Cvar_GetValue(const char *varName)
returns 0.0 if not defined or non numeric
void Com_SetRenderModified(bool modified)
void(* cvarChangeListenerFunc_t)(const char *cvarName, const char *oldValue, const char *newValue, void *data)
Callback for the change listener.
void Cvar_FixCheatVars(void)
Reset cheat cvar values to default.
virtual void onDelete(const struct cvar_s *cvar)=0
cvarChangeListener_t * Cvar_RegisterChangeListener(const char *varName, cvarChangeListenerFunc_t listenerFunc)
Registers a listener that is executed each time a cvar changed its value.
cvar_t * Cvar_Get(const char *varName, const char *value="", int flags=0, const char *desc=nullptr)
creates the variable if it doesn't exist, or returns the existing one if it exists, the value will not be changed, but flags will be ORed in that allows variables to be unarchived without needing bitflags
void Cvar_UnRegisterCvarListener(CvarListenerPtr listener)
Unregisters a cvar listener.
cvarChangeListenerFunc_t exec
struct cvarChangeListener_s cvarChangeListener_t
const char * Cvar_GetString(const char *varName)
returns an empty string if not defined
cvar_t * Cvar_FullSet(const char *varName, const char *value, int flags)
Sets a cvar from console with the given flags.
const char * Cvar_Serverinfo(char *info, size_t infoSize)
returns an info string containing all the CVAR_SERVERINFO cvars
void Cvar_UnRegisterChangeListener(const char *varName, cvarChangeListenerFunc_t listenerFunc)
Unregisters a cvar change listener.
bool Com_IsUserinfoModified(void)
void Cvar_Reset(cvar_t *cvar)
Sets the cvar value back to the old value.
void Cvar_UpdateLatchedVars(void)
any CVAR_LATCHED variables that have been set will now take effect
int Cvar_CompleteVariable(const char *partial, const char **match)
attempts to match a partial variable name for command line completion returns nullptr if nothing fits...
bool Cvar_AssertValue(cvar_t *cvar, float minVal, float maxVal, bool shouldBeIntegral)
this function checks cvar ranges and integral values
const GLuint *typedef void(APIENTRY *GenRenderbuffersEXT_t)(GLsizei
struct cvarList_s cvarList_t
cvarChangeListener_t * changeListener
void Cvar_RegisterCvarListener(CvarListenerPtr listener)
Registers a cvar listener.
bool Cvar_PendingCvars(int flags)
Checks whether there are pending cvars for the given flags.
bool(* check)(struct cvar_s *cvar)
SharedPtr< CvarListener > CvarListenerPtr
void Cvar_Init(void)
Reads in all archived cvars.
GLsizei const GLvoid * data
struct cvarChangeListener_s * next
bool Cvar_SetCheckFunction(const char *varName, bool(*check)(cvar_t *cvar))
Sets the check functions for a cvar (e.g. Cvar_Assert)
const char * Cvar_Userinfo(char *info, size_t infoSize)
returns an info string containing all the CVAR_USERINFO cvars
int Cvar_GetInteger(const char *varName)
returns 0 if not defined or non numeric
Listener for cvar changes.
cvar_t * Cvar_GetFirst(void)
Return the first cvar of the cvar list.
void format(__printf__, 1, 2)))
void Cvar_ClearVars(int flags)
virtual void onCreate(const struct cvar_s *cvar)=0
bool Com_IsRenderModified(void)
bool Cvar_Delete(const char *varName)
Function to remove the cvar and free the space.