cvar.c File Reference

Manage cvars. More...

#include "common.h"
#include "../shared/infostring.h"
Include dependency graph for cvar.c:

Go to the source code of this file.

Defines

#define CVAR_HASH_SIZE   64

Functions

void Com_SetUserinfoModified (qboolean modified)
qboolean Com_IsUserinfoModified (void)
void Com_SetRenderModified (qboolean modified)
qboolean Com_IsRenderModified (void)
static qboolean Cvar_InfoValidate (const char *s)
cvar_tCvar_FindVar (const char *varName)
 Searches for a cvar given by parameter.
float Cvar_GetValue (const char *varName)
 Returns the float value of a cvar.
qboolean Cvar_SetCheckFunction (const char *varName, qboolean(*check)(cvar_t *cvar))
 Set a checker function for cvar values.
qboolean Cvar_AssertValue (cvar_t *cvar, float minVal, float maxVal, qboolean shouldBeIntegral)
 Checks cvar values.
qboolean Cvar_AssertString (cvar_t *cvar, char **array, int arraySize)
 Checks cvar values.
int Cvar_GetInteger (const char *varName)
 Returns the int value of a cvar.
const char * Cvar_GetString (const char *varName)
 Returns the value of cvar as string.
const char * Cvar_VariableStringOld (const char *varName)
 Returns the old value of cvar as string before we changed it.
int Cvar_CompleteVariable (const char *partial, const char **match)
 Unix like tab completion for console variables.
qboolean Cvar_Delete (const char *varName)
 Function to remove the cvar and free the space.
cvar_tCvar_Get (const char *var_name, const char *var_value, int flags, const char *desc)
 Init or return a cvar.
static void Cvar_ExecuteChangeListener (const cvar_t *cvar)
 Executes the change listeners for a cvar.
static cvarChangeListener_tCvar_GetChangeListener (cvarChangeListenerFunc_t listenerFunc)
void Cvar_RegisterChangeListener (const char *varName, cvarChangeListenerFunc_t listenerFunc)
 Registers a listener that is executed each time a cvar changed its value.
void Cvar_UnRegisterChangeListener (const char *varName, cvarChangeListenerFunc_t listenerFunc)
 Unregisters a cvar change listener.
static cvar_tCvar_Set2 (const char *varName, const char *value, qboolean force)
 Sets a cvar values Handles write protection and latched cvars as expected.
cvar_tCvar_ForceSet (const char *varName, const char *value)
 Will set the variable even if NOSET or LATCH.
cvar_tCvar_Set (const char *varName, const char *value)
 Sets a cvar value.
cvar_tCvar_FullSet (const char *varName, const char *value, int flags)
 Sets a cvar from console with the given flags.
void Cvar_SetValue (const char *varName, float value)
 Expands value to a string and calls Cvar_Set.
void Cvar_UpdateLatchedVars (void)
 Any variables with latched values will now be updated.
qboolean Cvar_Command (void)
 Handles variable inspection and changing from the console.
static void Cvar_SetOld_f (void)
 Allows resetting cvars to old value from console.
static void Cvar_Define_f (void)
static void Cvar_Set_f (void)
 Allows setting and defining of arbitrary cvars from console.
static void Cvar_Copy_f (void)
 Allows copying variables Available via console command copy.
void Cvar_WriteVariables (qFILE *f)
 appends lines containing "set variable value" for all variables with the archive flag set to true.
qboolean Cvar_PendingCvars (int flags)
 Checks whether there are pending cvars for the given flags.
void Cvar_ClearVars (int flags)
static void Cvar_List_f (void)
 List all cvars via console command 'cvarlist'.
static char * Cvar_BitInfo (int bit)
 Return a string with all cvars with bitflag given by parameter set.
const char * Cvar_Userinfo (void)
 Returns an info string containing all the CVAR_USERINFO cvars.
const char * Cvar_Serverinfo (void)
 Returns an info string containing all the CVAR_SERVERINFO cvars.
static void Cvar_Del_f (void)
 Delete a cvar - set [cvar] "" isn't working from within the scripts.
static void Cvar_Add_f (void)
 Add a value to a cvar.
static void Cvar_Mod_f (void)
 Apply a modulo to a cvar.
void Cvar_FixCheatVars (void)
 Reset cheat cvar values to default.
void Cvar_Init (void)
 Reads in all archived cvars.
void Cvar_Shutdown (void)

Variables

static cvar_tcvarVarsHash [CVAR_HASH_SIZE]
static qboolean renderModified
 This is set each time a CVAR_USERINFO variable is changed so that the renderer knows to update stuff accordingly.
static qboolean userinfoModified
 This is set each time a CVAR_USERINFO variable is changed so that the client knows to send it to the server.
static cvar_tcvarVars
 Cvar list.

Detailed Description

Manage cvars.

cvar_t variables are used to hold scalar or string variables that can be changed or displayed at the console or prog code as well as accessed directly in C code. Cvars are restricted from having the same names as commands to keep this interface from being ambiguous.

Definition in file cvar.c.


Define Documentation

#define CVAR_HASH_SIZE   64

Definition at line 34 of file cvar.c.

Referenced by Cvar_Delete(), Cvar_FindVar(), and Cvar_Get().


Function Documentation

qboolean Com_IsRenderModified ( void   ) 

Definition at line 65 of file cvar.c.

References renderModified.

Referenced by R_BeginFrame().

qboolean Com_IsUserinfoModified ( void   ) 

Definition at line 55 of file cvar.c.

References userinfoModified.

Referenced by CL_SendChangedUserinfos().

void Com_SetRenderModified ( qboolean  modified  ) 

Definition at line 60 of file cvar.c.

References renderModified.

Referenced by Cvar_Set2(), Qcommon_Init(), and R_BeginFrame().

void Com_SetUserinfoModified ( qboolean  modified  ) 

Definition at line 50 of file cvar.c.

References userinfoModified.

Referenced by CL_Connect(), CL_SendChangedUserinfos(), Cvar_FullSet(), Cvar_Set2(), and Qcommon_Init().

static void Cvar_Add_f ( void   )  [static]

Add a value to a cvar.

Definition at line 1017 of file cvar.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_FindVar(), Cvar_SetValue(), cvar_s::value, and cvarlist_s::value.

Referenced by Cvar_Init().

qboolean Cvar_AssertString ( cvar_t cvar,
char **  array,
int  arraySize 
)

Checks cvar values.

this function checks whether the cvar string is a valid string in char ** array

Returns:
true if assert
See also:
Cvar_AssertValue
Parameters:
[in] cvar Cvar to check
[in] array Array of valid cvar value strings
[in] arraySize Number of entries in the string array

Definition at line 186 of file cvar.c.

References Com_Printf(), Cvar_Set(), i, cvar_s::name, cvar_s::oldString, qfalse, qtrue, cvar_s::string, and string.

qboolean Cvar_AssertValue ( cvar_t cvar,
float  minVal,
float  maxVal,
qboolean  shouldBeIntegral 
)

Checks cvar values.

this function checks cvar ranges and integral values

Returns:
true if assert
Parameters:
[in] cvar Cvar to check
[in] minVal The minimal value the cvar should have
[in] maxVal The maximal value the cvar should have
[in] shouldBeIntegral No floats for this cvar please
See also:
Cvar_AssertString

Definition at line 152 of file cvar.c.

References Com_Printf(), Cvar_Set(), Cvar_SetValue(), cvar_s::integer, cvar_s::name, qfalse, qtrue, va(), and cvar_s::value.

Referenced by CL_CvarCheckVidGamma(), CL_CvarCheckVidMode(), CL_CvarWorldLevel(), Com_CvarCheckMaxFPS(), R_CvarCheckDynamicLights(), R_CvarCheckLights(), R_CvarCheckMaxLightmap(), R_CvarPostProcess(), R_CvarPrograms(), and SV_CheckMaxSoldiersPerPlayer().

static char* Cvar_BitInfo ( int  bit  )  [static]

Return a string with all cvars with bitflag given by parameter set.

Parameters:
bit The bitflag we search the global cvar array for

Definition at line 967 of file cvar.c.

References cvar_s::flags, Info_SetValueForKey(), MAX_INFO_STRING, cvar_s::name, cvar_s::next, and cvar_s::string.

Referenced by Cvar_Serverinfo(), and Cvar_Userinfo().

void Cvar_ClearVars ( int  flags  ) 

Definition at line 880 of file cvar.c.

References cvar_s::flags, cvar_s::modified, cvar_s::next, and qfalse.

Referenced by R_Init().

qboolean Cvar_Command ( void   ) 

Handles variable inspection and changing from the console.

called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known command. Returns true if the command was a variable reference that was handled. (print or change)

Returns:
True if cvar exists - false otherwise

You can print the current value or set a new value with this function To set a new value for a cvar from within the console just type the cvar name followed by the value. To print the current cvar's value just type the cvar name and hit enter

See also:
Cvar_Set_f
Cvar_SetValue
Cvar_Set

Definition at line 739 of file cvar.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_FindVar(), Cvar_Set(), cvar_s::name, qfalse, qtrue, and cvar_s::string.

Referenced by Cmd_ExecuteString().

int Cvar_CompleteVariable ( const char *  partial,
const char **  match 
)

Unix like tab completion for console variables.

attempts to match a partial variable name for command line completion returns NULL if nothing fits

Parameters:
partial The beginning of the variable we try to complete
[out] match The found entry of the list we are searching, in case of more than one entry their common suffix is returned.
See also:
Cmd_CompleteCommand
Key_CompleteCommand

Definition at line 273 of file cvar.c.

References Cmd_GenericCompleteFunction(), COLORED_GREEN, Com_Printf(), CVAR_DEVELOPER, cvar_s::description, cvar_s::flags, len, MAX_COMPLETE, cvar_s::name, cvar_s::next, and cvar_s::string.

Referenced by Com_ConsoleCompleteCommand().

static void Cvar_Copy_f ( void   )  [static]

Allows copying variables Available via console command copy.

Definition at line 836 of file cvar.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_GetString(), and Cvar_Set().

Referenced by Cvar_Init().

static void Cvar_Define_f ( void   )  [static]

Definition at line 780 of file cvar.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_FindVar(), Cvar_Set(), and name.

Referenced by Cvar_Init().

static void Cvar_Del_f ( void   )  [static]

Delete a cvar - set [cvar] "" isn't working from within the scripts.

See also:
Cvar_Set_f

Definition at line 1001 of file cvar.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), and Cvar_Delete().

Referenced by Cvar_Init().

qboolean Cvar_Delete ( const char *  varName  ) 
static void Cvar_ExecuteChangeListener ( const cvar_t cvar  )  [static]

Executes the change listeners for a cvar.

Parameters:
cvar The cvar which change listeners are executed

Definition at line 438 of file cvar.c.

References cvar_s::changeListener, cvarListener_s::exec, cvar_s::name, cvarListener_s::next, cvar_s::oldString, and cvar_s::string.

Referenced by Cvar_Set2().

cvar_t* Cvar_FindVar ( const char *  varName  ) 
void Cvar_FixCheatVars ( void   ) 
cvar_t* Cvar_ForceSet ( const char *  varName,
const char *  value 
)
cvar_t* Cvar_FullSet ( const char *  varName,
const char *  value,
int  flags 
)

Sets a cvar from console with the given flags.

Note:
flags are: CVAR_ARCHIVE These cvars will be saved. CVAR_USERINFO Added to userinfo when changed. CVAR_SERVERINFO Added to serverinfo when changed. CVAR_NOSET Don't allow change from console at all but can be set from the command line. CVAR_LATCH Save changes until server restart.
Parameters:
varName Which cvar
value Which value for the cvar
flags which flags
See also:
Cvar_Set_f

Definition at line 662 of file cvar.c.

References com_cvarSysPool, Com_SetUserinfoModified(), Cvar_FindVar(), Cvar_Get(), CVAR_USERINFO, cvar_s::flags, cvar_s::integer, Mem_Free, Mem_PoolStrDup, cvar_s::modified, cvar_s::oldString, qtrue, cvar_s::string, and cvar_s::value.

Referenced by Cvar_Set_f(), and SV_Map().

cvar_t* Cvar_Get ( const char *  var_name,
const char *  var_value,
int  flags,
const char *  desc 
)

Init or return a cvar.

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

Parameters:
[in] var_name The cvar name
[in] var_value The standard cvar value (will be set if the cvar doesn't exist)
[in] flags CVAR_USERINFO, CVAR_LATCH, CVAR_SERVERINFO, CVAR_ARCHIVE and so on
[in] desc This is a short description of the cvar (see console command cvarlist)
Note:
CVAR_ARCHIVE: Cvar will be saved to config.cfg when game shuts down - and will be reloaded when game starts up the next time
CVAR_LATCH: Latched cvars will be updated at the next map load
CVAR_SERVERINFO: This cvar will be send in the server info response strings (server browser)
CVAR_NOSET: This cvar can not be set from the commandline
CVAR_USERINFO: This cvar will be added to the userinfo string when changed (network synced)
CVAR_DEVELOPER: Only changeable if we are in development mode If the variable already exists, the value will not be set The flags will be or'ed in if the variable exists.

Definition at line 377 of file cvar.c.

References com_cvarSysPool, Com_HashKey(), Com_Printf(), CVAR_CHEAT, Cvar_FindVar(), CVAR_HASH_SIZE, Cvar_InfoValidate(), CVAR_SERVERINFO, CVAR_USERINFO, cvar_s::defaultString, cvar_s::description, cvar_s::flags, hash(), HASH_Add, cvar_s::integer, Mem_Free, Mem_PoolAlloc, Mem_PoolStrDup, cvar_s::modified, cvar_s::name, cvar_s::next, cvar_s::oldString, cvar_s::prev, qtrue, cvar_s::string, and cvar_s::value.

Referenced by ACTOR_InitStartup(), B_InitCallbacks(), B_InitStartup(), CL_CameraInit(), CL_CheckCvars_f(), CL_Init(), CL_InitLocal(), CL_InitParticles(), CL_LanguageTest(), CL_ViewInit(), Con_Init(), CP_InitStartup(), Cvar_FullSet(), Cvar_Set2(), GAME_CP_InitStartup(), GAME_SK_InitStartup(), HTTP_InitStartup(), HUD_InitStartup(), IN_Init(), IN_StartupJoystick(), Irc_Init(), M_Init(), MAP_InitStartup(), MP_CallbacksInit(), MP_ServerListInit(), NET_Init(), PR_ProductionInit(), Qcommon_Init(), R_InitExtensions(), R_RegisterImageVars(), R_RegisterSystemVars(), R_SphereInit(), S_Init(), SAV_Init(), SCR_Init(), SEQ_InitSequence(), SV_Init(), SV_InitGame(), SV_InitGameProgs(), Sys_Init(), TOTD_InitStartup(), UFO_InitStartup(), UFO_InitSuiteRandomMapAssembly(), UI_GenInjectedString(), UI_GetFloatFromExpression(), UI_GetFloatFromNodeProperty(), UI_GetStringFromExpression(), UI_Init(), UI_InitDraw(), UI_InitWindows(), UI_TextEntryFocusGained(), UP_InitStartup(), and VID_Init().

static cvarChangeListener_t* Cvar_GetChangeListener ( cvarChangeListenerFunc_t  listenerFunc  )  [static]

Definition at line 447 of file cvar.c.

References com_cvarSysPool, cvarListener_s::exec, and Mem_PoolAlloc.

Referenced by Cvar_RegisterChangeListener().

int Cvar_GetInteger ( const char *  varName  ) 
const char* Cvar_GetString ( const char *  varName  ) 
float Cvar_GetValue ( const char *  varName  ) 

Returns the float value of a cvar.

returns 0.0 if not defined or non numeric

See also:
Cvar_GetString
Cvar_FindVar
Cvar_GetInteger
Returns:
0 if not defined

Definition at line 112 of file cvar.c.

References Cvar_FindVar(), and cvar_s::string.

Referenced by GAME_MP_StartServer_f(), R_PreprocessShader(), UI_EKGNodeDraw(), UI_GetReferenceFloat(), UI_Modify_f(), and UI_ModifyWrap_f().

static qboolean Cvar_InfoValidate ( const char *  s  )  [static]

Definition at line 75 of file cvar.c.

References qfalse, and qtrue.

Referenced by Cvar_Get(), and Cvar_Set2().

void Cvar_Init ( void   ) 

Reads in all archived cvars.

See also:
Qcommon_Init

Definition at line 1113 of file cvar.c.

References Cmd_AddCommand(), Cvar_Add_f(), Cvar_Copy_f(), Cvar_Define_f(), Cvar_Del_f(), Cvar_List_f(), Cvar_Mod_f(), Cvar_Set_f(), and Cvar_SetOld_f().

Referenced by Qcommon_Init(), and TEST_Init().

static void Cvar_List_f ( void   )  [static]
static void Cvar_Mod_f ( void   )  [static]

Apply a modulo to a cvar.

Definition at line 1039 of file cvar.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_FindVar(), Cvar_SetValue(), cvar_s::integer, and cvarlist_s::value.

Referenced by Cvar_Init().

qboolean Cvar_PendingCvars ( int  flags  ) 

Checks whether there are pending cvars for the given flags.

Parameters:
flags The CVAR_* flags
Returns:
true if there are pending cvars, false otherwise

Definition at line 869 of file cvar.c.

References cvar_s::flags, cvar_s::modified, cvar_s::next, qfalse, and qtrue.

Referenced by R_BeginFrame().

void Cvar_RegisterChangeListener ( const char *  varName,
cvarChangeListenerFunc_t  listenerFunc 
)

Registers a listener that is executed each time a cvar changed its value.

See also:
Cvar_ExecuteChangeListener
Parameters:
varName The cvar name to register the listener for
listenerFunc The listener callback to register

Definition at line 460 of file cvar.c.

References cvar_s::changeListener, Com_Printf(), Cvar_FindVar(), Cvar_GetChangeListener(), cvarListener_s::exec, and cvarListener_s::next.

Referenced by HUD_InitStartup().

const char* Cvar_Serverinfo ( void   ) 

Returns an info string containing all the CVAR_SERVERINFO cvars.

returns an info string containing all the CVAR_SERVERINFO cvars

See also:
SV_StatusString

Definition at line 992 of file cvar.c.

References Cvar_BitInfo(), and CVAR_SERVERINFO.

Referenced by SV_Serverinfo_f(), SV_ShowServerinfo_f(), and SVC_Status().

cvar_t* Cvar_Set ( const char *  varName,
const char *  value 
)

Sets a cvar value.

will create the variable if it doesn't exist

Parameters:
varName Which cvar should be set
value Which value should the cvar get
Note:
Look after the CVAR_LATCH stuff and check for write protected cvars

Definition at line 643 of file cvar.c.

References Cvar_Set2(), and qfalse.

Referenced by AC_AlienClick(), AC_UpdateMenu(), AIM_AircraftEquipMenuUpdate(), AIM_DrawAircraftSlots(), AIM_UpdateItemDescription(), AIR_AircraftSelect(), AIR_DeleteAircraft(), B_BuildingStatus(), B_DrawBuilding(), B_InitCallbacks(), B_SetBaseTitle_f(), B_SetCurrentSelectedBase(), BDEF_BaseDefenceMenuUpdate_f(), BS_BuyType(), BS_BuyType_f(), BS_MarketAircraftDescription(), BS_MarketClick_f(), CL_ActorCvars(), CL_BookmarkAdd_f(), CL_ChangeSkin_f(), CL_CharacterSkillAndScoreCvars(), CL_GameAutoGo(), CL_LanguageTryToSet(), CL_NationDrawStats(), CL_NationStatsUpdate_f(), CL_ParseServerInfoMessage(), CL_SelectTeam_Init_f(), CL_UGVCvars(), CL_UpdateActorAircraftVar(), CL_UpdateCredits(), CL_UpdateEmployeeList(), CL_UpdateTime(), Com_Error(), Com_SetGameType(), CP_CreateBattleParameters(), CP_SetMissionVars(), CP_StartMissionMap(), Cvar_AssertString(), Cvar_AssertValue(), Cvar_Command(), Cvar_Copy_f(), Cvar_Define_f(), Cvar_Set_f(), Cvar_SetOld_f(), Cvar_SetValue(), E_EmployeeList_f(), E_EmployeeListScroll_f(), E_UpdateGUICount_f(), GAME_CP_CampaignListClick_f(), GAME_CP_CharacterCvars(), GAME_CP_MissionAutoCheck_f(), GAME_MP_ChangeGametype_f(), GAME_MP_InitStartup(), GAME_MP_MapInfo(), GAME_MP_StartServer_f(), GAME_SK_ChangeEquip_f(), GAME_SK_HideDropships(), GAME_SK_HideUFOs(), GAME_SK_SetMissionParameters(), HOS_UpdateMenu(), HUD_RefreshButtons(), HUD_Update(), HUD_UpdateActor(), HUD_UpdateActorCvar(), IN_StartupJoystick(), INS_DestroyInstallation(), INS_InitCallbacks(), INS_LoadXML(), INS_ParseInstallations(), INS_SelectInstallation(), INS_SetCurrentSelectedInstallation(), INS_SetInstallationTitle(), INV_ItemDescription(), Irc_Connect_f(), Irc_UserClick_f(), M_Change_f(), M_Play_f(), M_RandomTrack_f(), MAP_DrawMapMarkers(), MAP_DrawMapOneMission(), MP_LoadTeamMultiplayer(), MP_MultiplayerTeamSlotComments_f(), MP_UpdateMenuParameters_f(), PR_AircraftInfo(), PR_DisassemblyInfo(), PR_ItemProductionInfo(), PR_ProductionInfo(), PR_ProductionList_f(), PR_ProductionType_f(), R_InitPrograms(), R_VerifyDriver(), RS_InitGUI(), RS_UpdateInfo(), SAV_GameSaveNameCleanup_f(), SCR_SetLoadingBackground(), SEQ_ExecuteMusic(), SV_GetCvarToken(), SV_Init(), SV_InitGameProgs(), SV_NextMapcycle(), SV_SetMaster_f(), TR_Init_f(), TR_TransferBaseSelect(), UI_EditorNodeSelectNode(), UI_InitStack(), UI_MapInfo(), UI_MaterialEditorUpdate(), UI_Popup(), UI_PopupButton(), UI_PopupList(), UI_SetCvar(), UI_Translate_f(), UP_AircraftDescription(), UP_AircraftItemDescription(), UP_Article(), UP_BuildingDescription(), UP_ChangeDisplay(), UP_DisplayTechTree(), UP_DrawAssociatedAmmo(), UP_GenerateSummary(), UP_GetUnreadMails(), UP_InitStartup(), UP_SetAllMailsRead_f(), UP_SetMailButtons_f(), UP_SetMailHeader(), UP_UGVDescription(), UR_DialogInit_f(), UR_DialogInitStore_f(), and UR_DialogSelectSellNation_f().

static cvar_t* Cvar_Set2 ( const char *  varName,
const char *  value,
qboolean  force 
) [static]

Sets a cvar values Handles write protection and latched cvars as expected.

Parameters:
[in] varName Which cvar
[in] value Set the cvar to the value specified by 'value'
[in] force Force the update of the cvar

Definition at line 533 of file cvar.c.

References cvar_s::check, com_cvarSysPool, Com_Printf(), Com_ServerState(), Com_SetRenderModified(), Com_SetUserinfoModified(), CVAR_DEVELOPER, Cvar_ExecuteChangeListener(), Cvar_FindVar(), Cvar_Get(), Cvar_InfoValidate(), CVAR_LATCH, CVAR_NOSET, CVAR_R_MASK, CVAR_SERVERINFO, CVAR_USERINFO, cvar_s::flags, cvar_s::integer, cvar_s::latchedString, Mem_Free, Mem_PoolStrDup, cvar_s::modified, cvar_s::oldString, qtrue, cvar_s::string, and cvar_s::value.

Referenced by Cvar_ForceSet(), and Cvar_Set().

static void Cvar_Set_f ( void   )  [static]

Allows setting and defining of arbitrary cvars from console.

Definition at line 798 of file cvar.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), CVAR_ARCHIVE, Cvar_FullSet(), CVAR_SERVERINFO, Cvar_Set(), and CVAR_USERINFO.

Referenced by Cvar_Init().

qboolean Cvar_SetCheckFunction ( const char *  varName,
qboolean(*)(cvar_t *cvar)  check 
)

Set a checker function for cvar values.

Sets the check functions for a cvar (e.g. Cvar_Assert).

See also:
Cvar_FindVar
Returns:
true if set

Definition at line 128 of file cvar.c.

References check, cvar_s::check, Com_Printf(), Cvar_FindVar(), qfalse, and qtrue.

Referenced by HUD_InitStartup(), Qcommon_Init(), R_InitExtensions(), R_RegisterSystemVars(), SV_Init(), and VID_Init().

static void Cvar_SetOld_f ( void   )  [static]

Allows resetting cvars to old value from console.

Definition at line 761 of file cvar.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_FindVar(), Cvar_Set(), and cvar_s::oldString.

Referenced by Cvar_Init().

void Cvar_SetValue ( const char *  varName,
float  value 
)

Expands value to a string and calls Cvar_Set.

expands value to a string and calls Cvar_Set

Note:
Float values are in the format #.##

Definition at line 696 of file cvar.c.

References Com_sprintf(), and Cvar_Set().

Referenced by AC_UpdateMenu(), AIR_AircraftSelect(), AIR_DeleteAircraft(), B_BaseInit_f(), B_InitCallbacks(), B_MakeBaseMapShot_f(), B_SetCurrentSelectedBase(), B_UpdateBaseCount(), CL_ActorEquipmentSelect_f(), CL_ActorSelectList(), CL_CameraRoute(), CL_ChangeSkin_f(), CL_GameAutoGo(), CL_LevelDown_f(), CL_LevelUp_f(), CL_ParseTeamInfoMessage(), CL_TeamNum_f(), CL_UpdateTime(), CL_ViewCenterAtGridPosition(), Com_DeveloperSet_f(), CP_CampaignInit(), CP_CheckLostCondition(), CP_SetMissionVars(), CP_StartSelectedMission(), CP_UpdateXVIMapButton(), Cvar_Add_f(), Cvar_AssertValue(), Cvar_Mod_f(), E_EmployeeSelect(), E_UpdateGUICount_f(), GAME_MP_StartServer_f(), GAME_SK_SetMissionParameters(), HOS_EmployeeInit_f(), HUD_Update(), HUD_UpdateActorCvar(), HUD_UpdateAllActors(), IN_Frame(), INS_BuildInstallation_f(), INS_InitCallbacks(), INS_UpdateInsatallationLimit_f(), INV_UpdateObject_f(), LE_CenterView(), PR_ProductionIncrease_f(), PR_ProductionInfo(), PR_ProductionList_f(), R_BeginFrame(), R_CvarCheckDynamicLights(), R_CvarCheckLights(), R_CvarCheckMaxLightmap(), R_CvarPostProcess(), R_CvarPrograms(), R_InitExtensions(), R_SetMode(), R_SphereInit(), R_VerifyDriver(), RS_InitGUI(), RS_UpdateInfo(), SCR_TouchPics(), SP_worldspawn(), SV_Map_f(), Sys_SetAffinityAndPriority(), TR_Init_f(), TR_TransferBaseSelect(), UI_GenAllRadarMap(), UI_InvalidateStack(), UI_Modify_f(), UI_ModifyWrap_f(), UI_SetCvar(), UP_Article(), UP_ChangeDisplay(), UP_MailClientClick_f(), and UR_DialogInit_f().

void Cvar_Shutdown ( void   ) 

Definition at line 1125 of file cvar.c.

Referenced by Qcommon_Shutdown(), and TEST_Shutdown().

void Cvar_UnRegisterChangeListener ( const char *  varName,
cvarChangeListenerFunc_t  listenerFunc 
)

Unregisters a cvar change listener.

Parameters:
varName The cvar name to register the listener for
listenerFunc The listener callback to unregister

Definition at line 499 of file cvar.c.

References cvar_s::changeListener, Com_Printf(), Cvar_FindVar(), cvarListener_s::exec, Mem_Free, and cvarListener_s::next.

void Cvar_UpdateLatchedVars ( void   ) 

Any variables with latched values will now be updated.

any CVAR_LATCHED variables that have been set will now take effect

Note:
CVAR_LATCH cvars are not updated during a game (tactical mission)

Definition at line 712 of file cvar.c.

References cvar_s::integer, cvar_s::latchedString, cvar_s::next, cvar_s::oldString, cvar_s::string, and cvar_s::value.

Referenced by SV_InitGame().

const char* Cvar_Userinfo ( void   ) 

Returns an info string containing all the CVAR_USERINFO cvars.

returns an info string containing all the CVAR_USERINFO cvars

Definition at line 983 of file cvar.c.

References Cvar_BitInfo(), and CVAR_USERINFO.

Referenced by CL_Connect(), CL_SendChangedUserinfos(), and CL_UserInfo_f().

const char* Cvar_VariableStringOld ( const char *  varName  ) 

Returns the old value of cvar as string before we changed it.

returns an empty string if not defined

See also:
Cvar_GetValue
Cvar_FindVar

Even if the cvar does not exist this function will not return a null pointer but an empty string

Definition at line 253 of file cvar.c.

References Cvar_FindVar(), and cvar_s::oldString.

Referenced by GAME_MP_InitStartup().

void Cvar_WriteVariables ( qFILE f  ) 

appends lines containing "set variable value" for all variables with the archive flag set to true.

Note:
Stores the archive cvars

Definition at line 855 of file cvar.c.

References CVAR_ARCHIVE, cvar_s::flags, FS_Printf(), cvar_s::name, cvar_s::next, and cvar_s::string.

Referenced by Com_WriteConfigToFile().


Variable Documentation

cvar_t* cvarVars [static]

Cvar list.

Definition at line 73 of file cvar.c.

cvar_t* cvarVarsHash[CVAR_HASH_SIZE] [static]

Definition at line 36 of file cvar.c.

This is set each time a CVAR_USERINFO variable is changed so that the renderer knows to update stuff accordingly.

Definition at line 42 of file cvar.c.

Referenced by Com_IsRenderModified(), and Com_SetRenderModified().

This is set each time a CVAR_USERINFO variable is changed so that the client knows to send it to the server.

Definition at line 48 of file cvar.c.

Referenced by Com_IsUserinfoModified(), and Com_SetUserinfoModified().


Generated by  doxygen 1.6.2