Manage cvars. More...
#include "common.h"
#include "../shared/infostring.h"
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_t * | Cvar_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_t * | Cvar_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_t * | Cvar_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_t * | Cvar_Set2 (const char *varName, const char *value, qboolean force) |
Sets a cvar values Handles write protection and latched cvars as expected. | |
cvar_t * | Cvar_ForceSet (const char *varName, const char *value) |
Will set the variable even if NOSET or LATCH. | |
cvar_t * | Cvar_Set (const char *varName, const char *value) |
Sets a cvar value. | |
cvar_t * | Cvar_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_t * | cvarVarsHash [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_t * | cvarVars |
Cvar list. |
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 CVAR_HASH_SIZE 64 |
Definition at line 34 of file cvar.c.
Referenced by Cvar_Delete(), Cvar_FindVar(), and Cvar_Get().
qboolean Com_IsRenderModified | ( | void | ) |
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().
Checks cvar values.
this function checks whether the cvar string is a valid string in char ** array
[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.
Checks cvar values.
this function checks cvar ranges and integral values
[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 |
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.
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)
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
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
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. |
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.
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 | ) |
Function to remove the cvar and free the space.
Definition at line 307 of file cvar.c.
References cvar_s::changeListener, Com_HashKey(), Com_Printf(), CVAR_HASH_SIZE, CVAR_LATCH, CVAR_NOSET, CVAR_SERVERINFO, CVAR_USERINFO, cvar_s::defaultString, cvar_s::description, cvar_s::flags, hash(), cvar_s::hash_next, cvar_s::latchedString, Mem_Free, cvar_s::name, cvarListener_s::next, cvar_s::next, cvar_s::oldString, cvar_s::prev, Q_strcasecmp, qfalse, qtrue, and cvar_s::string.
Referenced by B_ShutdownCallbacks(), Cvar_Del_f(), GAME_SK_Shutdown(), INS_ShutdownCallbacks(), UI_ExecuteAction(), and UP_Shutdown().
static void Cvar_ExecuteChangeListener | ( | const cvar_t * | cvar | ) | [static] |
Executes the change listeners for a cvar.
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 | ) |
Searches for a cvar given by parameter.
varName | The cvar name as string |
NULL
if no cvar with the specified name was found Definition at line 93 of file cvar.c.
References Com_HashKey(), CVAR_HASH_SIZE, hash(), cvar_s::hash_next, and cvar_s::name.
Referenced by Cvar_Add_f(), Cvar_Command(), Cvar_Define_f(), Cvar_FullSet(), Cvar_Get(), Cvar_GetInteger(), Cvar_GetString(), Cvar_GetValue(), Cvar_Mod_f(), Cvar_RegisterChangeListener(), Cvar_Set2(), Cvar_SetCheckFunction(), Cvar_SetOld_f(), Cvar_UnRegisterChangeListener(), Cvar_VariableStringOld(), INV_UpdateObject_f(), SAV_GameLoad_f(), SV_GetCvarToken(), UI_GetBooleanFromExpression(), UI_SetCvar(), and UI_TabNodeInit().
void Cvar_FixCheatVars | ( | void | ) |
Reset cheat cvar values to default.
Definition at line 1062 of file cvar.c.
References com_cvarSysPool, Com_Printf(), Com_ServerState(), CVAR_CHEAT, Cvar_GetInteger(), cvar_s::defaultString, cvar_s::flags, cvar_s::integer, Mem_Free, Mem_PoolStrDup, cvar_s::name, cvar_s::next, cvar_s::oldString, cvar_s::string, and cvar_s::value.
Referenced by CL_SendCommand().
cvar_t* Cvar_ForceSet | ( | const char * | varName, | |
const char * | value | |||
) |
Will set the variable even if NOSET or LATCH.
will set the variable even if NOSET or LATCH
Definition at line 632 of file cvar.c.
References Cvar_Set2(), and qtrue.
Referenced by CL_ActorEquipmentSelect_f(), CL_ActorPilotSelect_f(), CL_ActorSelect(), CL_ActorTeamSelect_f(), CL_CharacterSkillAndScoreCvars(), CL_UpdateEquipmentMenuParameters_f(), GAME_CP_InitStartup(), GAME_MP_InitStartup(), GAME_SK_InitStartup(), INV_ItemDescription(), Irc_Client_CmdNick(), Irc_Client_CmdTopic(), Irc_Client_Join(), Irc_Client_Msg_f(), Irc_Logic_Disconnect(), Qcommon_Init(), UI_ExecuteSetAction(), UI_TabNodeInit(), UI_TextEntryNodeAbortEdition(), and UI_TextEntryNodeEdit().
cvar_t* Cvar_FullSet | ( | const char * | varName, | |
const char * | value, | |||
int | flags | |||
) |
Sets a cvar from console with the given flags.
varName | Which cvar | |
value | Which value for the cvar | |
flags | which flags |
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
[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) |
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 | ) |
Returns the int value of a cvar.
returns 0 if not defined or non numeric
Definition at line 217 of file cvar.c.
References Cvar_FindVar(), and cvar_s::integer.
Referenced by CL_ChangeSkin_f(), CL_ChangeSkinForWholeTeam_f(), CL_Connect_f(), CL_UpdateEmployeeList(), Com_DeveloperSet_f(), Cvar_FixCheatVars(), E_ChangeName_f(), GAME_CP_Results_f(), GAME_MP_StartServer_f(), GAME_SK_Start_f(), MAP_DrawMapMarkers(), MAP_DrawMapOnePhalanxAircraft(), MAP_MapClick(), and UI_GenRadarMap_f().
const char* Cvar_GetString | ( | const char * | varName | ) |
Returns the value of cvar as string.
returns an empty string if not defined
Even if the cvar does not exist this function will not return a null pointer but an empty string
Definition at line 235 of file cvar.c.
References Cvar_FindVar(), and cvar_s::string.
Referenced by AIM_UpdateItemDescription(), AIR_ChangeAircraftName_f(), B_ChangeBaseName_f(), BS_MarketInfoClick_f(), CL_BookmarkAdd_f(), CL_CompleteNetworkAddress(), CL_ServerInfo_f(), CL_StartHTTPDownload(), Cmd_AddCommand(), Cmd_TokenizeString(), Com_MacroExpandString(), Cvar_Copy_f(), E_ChangeName_f(), GAME_GetTeamDef(), GAME_SK_ChangeEquip_f(), GAME_SK_Start_f(), HTTP_GetURL(), INS_BuildInstallation_f(), INS_ChangeInstallationName_f(), INS_SetInstallationTitle(), Irc_Client_CmdPrivmsg(), M_Play_f(), MP_SaveTeamMultiplayer_f(), SCR_SetLoadingBackground(), SV_InitGameProgs(), SVC_TeamInfo(), UI_GenRadarMap_f(), UI_MaterialEditorUpdate(), and UI_Translate_f().
float Cvar_GetValue | ( | const char * | varName | ) |
Returns the float value of a cvar.
returns 0.0 if not defined or non numeric
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.
Referenced by Cvar_Get(), and Cvar_Set2().
void Cvar_Init | ( | void | ) |
Reads in all archived cvars.
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] |
List all cvars via console command 'cvarlist'.
Definition at line 892 of file cvar.c.
References Cmd_Argc(), Cmd_Argv(), COLORED_GREEN, Com_Printf(), CVAR_ARCHIVE, CVAR_DEVELOPER, CVAR_LATCH, CVAR_NOSET, CVAR_R_IMAGES, CVAR_SERVERINFO, CVAR_USERINFO, cvar_s::description, cvar_s::flags, i, cvar_s::modified, cvar_s::name, cvar_s::next, and cvar_s::string.
Referenced by Cvar_Init().
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.
flags | The CVAR_* flags |
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.
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
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
varName | Which cvar should be set | |
value | Which value should the cvar get |
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().
Sets a cvar values Handles write protection and latched cvars as expected.
[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().
Set a checker function for cvar values.
Sets the check functions for a cvar (e.g. Cvar_Assert).
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
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.
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
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
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.
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().
cvar_t* cvarVarsHash[CVAR_HASH_SIZE] [static] |
qboolean renderModified [static] |
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().
qboolean userinfoModified [static] |
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().