|
UFO: Alien Invasion
|
Cvar (console variable) header file. More...


Go to the source code of this file.
Data Structures | |
| struct | cvarChangeListener_t |
| struct | cvar_t |
| This is a cvar definition. Cvars can be user modified and used in our menus e.g. More... | |
| struct | cvarList_t |
| class | CvarListener |
| Listener for cvar changes. More... | |
Macros | |
| #define | CVAR_ARCHIVE 1 |
| #define | CVAR_USERINFO 2 |
| #define | CVAR_SERVERINFO 4 |
| #define | CVAR_NOSET 8 |
| #define | CVAR_LATCH 16 |
| #define | CVAR_DEVELOPER 32 |
| #define | CVAR_CHEAT 64 |
| #define | CVAR_R_IMAGES 128 |
| #define | CVAR_R_CONTEXT 256 |
| #define | CVAR_R_PROGRAMS 512 |
| #define | CVAR_R_MASK (CVAR_R_IMAGES | CVAR_R_CONTEXT | CVAR_R_PROGRAMS) |
Typedefs | |
| typedef void(* | cvarChangeListenerFunc_t) (const char *cvarName, const char *oldValue, const char *newValue, void *data) |
| Callback for the change listener. More... | |
| typedef SharedPtr< CvarListener > | CvarListenerPtr |
Functions | |
| cvar_t * | Cvar_GetFirst (void) |
| Return the first cvar of the cvar list. More... | |
| 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 More... | |
| cvar_t * | Cvar_Set (const char *varName, const char *value,...) __attribute__((format(__printf__ |
| will create the variable if it doesn't exist More... | |
| cvar_t cvar_t * | Cvar_ForceSet (const char *varName, const char *value) |
| will set the variable even if NOSET or LATCH More... | |
| cvar_t * | Cvar_FullSet (const char *varName, const char *value, int flags) |
| Sets a cvar from console with the given flags. More... | |
| void | Cvar_SetValue (const char *varName, float value) |
| expands value to a string and calls Cvar_Set More... | |
| int | Cvar_GetInteger (const char *varName) |
| returns 0 if not defined or non numeric More... | |
| float | Cvar_GetValue (const char *varName) |
| returns 0.0 if not defined or non numeric More... | |
| const char * | Cvar_GetString (const char *varName) |
| returns an empty string if not defined More... | |
| const char * | Cvar_VariableStringOld (const char *varName) |
| returns an empty string if not defined More... | |
| 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 More... | |
| void | Cvar_UpdateLatchedVars (void) |
| any CVAR_LATCHED variables that have been set will now take effect More... | |
| bool | Cvar_Command (void) |
| 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) More... | |
| void | Cvar_Init (void) |
| Reads in all archived cvars. More... | |
| void | Cvar_Shutdown (void) |
| const char * | Cvar_Userinfo (char *info, size_t infoSize) |
| returns an info string containing all the CVAR_USERINFO cvars More... | |
| const char * | Cvar_Serverinfo (char *info, size_t infoSize) |
| returns an info string containing all the CVAR_SERVERINFO cvars More... | |
| bool | Cvar_AssertValue (cvar_t *cvar, float minVal, float maxVal, bool shouldBeIntegral) |
| this function checks cvar ranges and integral values More... | |
| bool | Cvar_SetCheckFunction (const char *varName, bool(*check)(cvar_t *cvar)) |
| Sets the check functions for a cvar (e.g. Cvar_Assert) More... | |
| cvarChangeListener_t * | Cvar_RegisterChangeListener (const char *varName, cvarChangeListenerFunc_t listenerFunc) |
| Registers a listener that is executed each time a cvar changed its value. More... | |
| void | Cvar_UnRegisterChangeListener (const char *varName, cvarChangeListenerFunc_t listenerFunc) |
| Unregisters a cvar change listener. More... | |
| void | Cvar_RegisterCvarListener (CvarListenerPtr listener) |
| Registers a cvar listener. More... | |
| void | Cvar_UnRegisterCvarListener (CvarListenerPtr listener) |
| Unregisters a cvar listener. More... | |
| void | Cvar_FixCheatVars (void) |
| Reset cheat cvar values to default. More... | |
| bool | Cvar_Delete (const char *varName) |
| Function to remove the cvar and free the space. More... | |
| cvar_t * | Cvar_FindVar (const char *varName) |
| Searches for a cvar given by parameter. More... | |
| bool | Cvar_PendingCvars (int flags) |
| Checks whether there are pending cvars for the given flags. More... | |
| void | Com_SetUserinfoModified (bool modified) |
| bool | Com_IsUserinfoModified (void) |
| void | Com_SetRenderModified (bool modified) |
| bool | Com_IsRenderModified (void) |
| void | Cvar_ClearVars (int flags) |
| void | Cvar_Reset (cvar_t *cvar) |
| Sets the cvar value back to the old value. More... | |
Cvar (console variable) header file.
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. The user can access cvars from the console in three ways: r_draworder prints the current value r_draworder 0 sets the current value to 0 set r_draworder 0 as above, but creates the cvar if not present Cvars are restricted from having the same names as commands to keep this interface from being ambiguous.
Definition in file cvar.h.
| #define CVAR_CHEAT 64 |
| #define CVAR_DEVELOPER 32 |
| #define CVAR_NOSET 8 |
| #define CVAR_R_CONTEXT 256 |
| #define CVAR_R_MASK (CVAR_R_IMAGES | CVAR_R_CONTEXT | CVAR_R_PROGRAMS) |
| typedef SharedPtr<CvarListener> CvarListenerPtr |
| bool Com_IsRenderModified | ( | void | ) |
| bool Com_IsUserinfoModified | ( | void | ) |
Definition at line 61 of file cvar.cpp.
References userinfoModified.
Referenced by CL_SendChangedUserinfos().
| void Com_SetRenderModified | ( | bool | modified | ) |
Definition at line 66 of file cvar.cpp.
References renderModified.
Referenced by Cvar_Set2(), Qcommon_Init(), and R_BeginFrame().
| void Com_SetUserinfoModified | ( | bool | modified | ) |
Definition at line 56 of file cvar.cpp.
References userinfoModified.
Referenced by CL_Connect(), CL_SendChangedUserinfos(), Cvar_FullSet(), Cvar_Set2(), and Qcommon_Init().
| bool Cvar_AssertValue | ( | cvar_t * | cvar, |
| float | minVal, | ||
| float | maxVal, | ||
| bool | shouldBeIntegral | ||
| ) |
this function checks cvar ranges and integral values
this function checks cvar ranges and integral values
true if assert isn't true and the cvar was changed to a valid value, false if the new value is ok and nothing was changed. | [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 161 of file cvar.cpp.
References Com_Printf(), Cvar_Set(), Cvar_SetValue(), cvar_t::integer, cvar_t::name, and cvar_t::value.
Referenced by CL_CvarCheckVidGamma(), CL_CvarCheckVidMode(), CL_CvarWorldLevel(), Com_CvarCheckMaxFPS(), R_CvarCheckDynamicLights(), R_CvarCheckMaxLightmap(), R_CvarCheckMultisample(), R_CvarCheckWeather(), R_CvarPostProcess(), R_CvarPrograms(), and SV_CheckMaxSoldiersPerPlayer().
Definition at line 891 of file cvar.cpp.
References cvarVars, and cvar_t::next.
Referenced by R_BeginFrame(), and R_Init().
| bool Cvar_Command | ( | void | ) |
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)
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 708 of file cvar.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_FindVar(), Cvar_Set(), and v.
Referenced by Cmd_vExecuteString().
| 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
attempts to match a partial variable name for command line completion returns nullptr 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 258 of file cvar.cpp.
References Cmd_GenericCompleteFunction(), Com_Printf(), CVAR_DEVELOPER, cvarVars, cvar_t::next, and S_COLOR_GREEN.
Referenced by Com_ConsoleCompleteCommand().
| bool Cvar_Delete | ( | const char * | varName | ) |
Function to remove the cvar and free the space.
Definition at line 279 of file cvar.cpp.
References cvar_t::changeListener, Com_HashKey(), Com_Printf(), CVAR_HASH_SIZE, cvarListeners, cvarVars, cvarVarsHash, cvar_t::defaultString, cvar_t::description, cvar_t::flags, hash, HASH_Delete, cvar_t::hash_next, i, cvar_t::latchedString, Mem_Free, cvar_t::name, cvarChangeListener_t::next, cvar_t::next, cvar_t::oldString, cvar_t::prev, Q_strcasecmp, and cvar_t::string.
Referenced by _wrap_delvar(), Cvar_Del_f(), GAME_GetImportData(), GAMECvarListener::onGameModeChange(), and UI_ExecuteAction().
| cvar_t * Cvar_FindVar | ( | const char * | varName | ) |
Searches for a cvar given by parameter.
| varName | The cvar name as string |
nullptr if no cvar with the specified name was found Definition at line 106 of file cvar.cpp.
References Com_HashKey(), CVAR_HASH_SIZE, cvarVarsHash, hash, cvar_t::hash_next, and Q_streq.
Referenced by _wrap_findvar(), 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_Set_f(), Cvar_SetCheckFunction(), Cvar_SetOld_f(), Cvar_Switch_f(), Cvar_UnRegisterChangeListener(), Cvar_VariableStringOld(), INV_UpdateObject_f(), uiCvarNode::onWindowClosed(), uiTabNode::onWindowOpened(), SV_GetCvarToken(), UI_GetBooleanFromExpression(), and UI_RemoveCvarListener_f().
Reset cheat cvar values to default.
Definition at line 1042 of file cvar.cpp.
References com_cvarSysPool, Com_Printf(), Com_ServerState(), CVAR_CHEAT, Cvar_GetInteger(), cvarVars, Mem_Free, Mem_PoolStrDup, cvar_t::next, and Q_streq.
Referenced by CL_SendCommand().
will set the variable even if NOSET or LATCH
will set the variable even if NOSET or LATCH
Definition at line 604 of file cvar.cpp.
References Cvar_Set2().
Referenced by CL_ActorSelect(), CL_CharacterSkillAndScoreCvars(), GAME_GetImportData(), INV_ItemDescription(), Irc_Client_CmdNick(), Irc_Client_CmdTopic(), Irc_Client_Join(), Irc_Client_Msg_f(), Irc_Logic_Disconnect(), uiTextEntryNode::onFocusGained(), uiTabNode::onWindowOpened(), Qcommon_Init(), SV_StartGame_f(), UI_ExecuteSetAction(), UI_TextEntryNodeAbortEdition(), and UI_TextEntryNodeEdit().
Sets a cvar from console with the given flags.
| varName | Which cvar |
| value | Which value for the cvar |
| flags | which flags |
Definition at line 640 of file cvar.cpp.
References com_cvarSysPool, Com_SetUserinfoModified(), Cvar_FindVar(), Cvar_Get(), CVAR_USERINFO, cvar_t::flags, cvar_t::integer, Mem_Free, Mem_PoolStrDup, cvar_t::modified, cvar_t::oldString, cvar_t::string, and cvar_t::value.
Referenced by Cvar_Set_f(), Cvar_Switch_f(), GAME_SetMode(), and SV_Map().
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
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 342 of file cvar.cpp.
References com_cvarSysPool, Com_HashKey(), Com_Printf(), CVAR_CHEAT, Cvar_FindVar(), CVAR_HASH_SIZE, Cvar_InfoValidate(), CVAR_SERVERINFO, CVAR_USERINFO, cvarListeners, cvarVars, cvarVarsHash, cvar_t::defaultString, cvar_t::description, cvar_t::flags, hash, HASH_Add, i, cvar_t::integer, Mem_Free, Mem_PoolAllocType, Mem_PoolStrDup, cvar_t::modified, cvar_t::name, cvar_t::next, cvar_t::oldString, cvar_t::string, and cvar_t::value.
Referenced by _wrap_getvar__SWIG_0(), _wrap_getvar__SWIG_1(), _wrap_getvar__SWIG_2(), _wrap_getvar__SWIG_3(), ACTOR_InitStartup(), CL_CameraInit(), CL_Init(), CL_InitLocal(), CL_LanguageInit(), CL_ViewInit(), Con_Init(), Cvar_FullSet(), Cvar_Set2(), GAME_GetImportData(), HTTP_InitStartup(), HUD_InitStartup(), IN_Init(), IN_StartupJoystick(), Irc_Init(), M_Init(), NET_Init(), uiTextEntryNode::onFocusGained(), PTL_InitStartup(), Qcommon_Init(), R_InitExtensions(), R_RegisterSystemVars(), R_RestartPrograms_f(), R_SphereInit(), S_Init(), S_MumbleInit(), SCR_Init(), CampaignTest::SetUpTestCase(), FootStepTest::SetUpTestCase(), GameTest::SetUpTestCase(), MapDefTest::SetUpTestCase(), MapDefMassRMATest::SetUpTestCase(), MapDefStatsTest::SetUpTestCase(), RandomMapAssemblyTest::SetUpTestCase(), SV_Init(), SV_InitGameProgs(), Sys_Init(), TEST_F(), TEST_Init(), TOTD_InitStartup(), UI_AbstractOption_SetCvar(), UI_GenInjectedString(), UI_GetFloatFromExpression(), UI_GetFloatFromNodeProperty(), UI_GetStringFromExpression(), UI_Init(), UI_InitDraw(), UI_InitWindows(), UI_RadioButton_SetCvar(), UI_RegisterGeoscapeNode(), VID_Init(), WEB_CGameCvars(), and WEB_InitStartup().
Return the first cvar of the cvar list.
Definition at line 81 of file cvar.cpp.
References cvarVars.
Referenced by CL_Init(), and CL_Shutdown().
| int Cvar_GetInteger | ( | const char * | varName | ) |
returns 0 if not defined or non numeric
returns 0 if not defined or non numeric
Definition at line 194 of file cvar.cpp.
References Cvar_FindVar(), and cvar_t::integer.
Referenced by CL_BattlescapeRadarGenerate_f(), CL_ChangeSkin_f(), CL_ChangeSkinForWholeTeam_f(), CL_NextAlien_f(), CL_PrevAlien_f(), Com_DeveloperSet_f(), Cvar_FixCheatVars(), Cvar_Switch_f(), GAME_GetImportData(), GAME_GetSelectedChr(), Weather::render(), and Weather::update().
| const char * Cvar_GetString | ( | const char * | varName | ) |
returns an empty string if not defined
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 210 of file cvar.cpp.
References Cvar_FindVar(), and cvar_t::string.
Referenced by CL_BattlescapeRadarGenerate_f(), CL_ConnectionlessPacket(), Cmd_AddCommand(), Cmd_TokenizeString(), Com_MacroExpandString(), Cvar_Copy_f(), FS_InitFilesystem(), GAME_GetEquipment(), GAME_GetImportData(), GAME_GetTeamDef(), Irc_Client_CmdPrivmsg(), M_Play_f(), SV_InitGameProgs(), SV_Map(), SVC_TeamInfo(), TEST_F(), and UI_MaterialEditorUpdate().
| float Cvar_GetValue | ( | const char * | varName | ) |
returns 0.0 if not defined or non numeric
returns 0.0 if not defined or non numeric
Definition at line 125 of file cvar.cpp.
References Cvar_FindVar(), and cvar_t::string.
Referenced by uiGeoscapeNode::draw(), GAME_GetImportData(), IN_SetMouseSpace(), R_PreprocessShaderR(), and UI_GetReferenceFloat().
Reads in all archived cvars.
Definition at line 1087 of file cvar.cpp.
References Cmd_AddCommand(), Cvar_Add_f(), Cvar_Copy_f(), Cvar_Define_f(), Cvar_Del_f(), Cvar_List_f(), Cvar_Mod_f(), Cvar_Set_f(), Cvar_SetOld_f(), and Cvar_Switch_f().
Referenced by Qcommon_Init(), and TEST_Init().
| bool Cvar_PendingCvars | ( | int | flags | ) |
Checks whether there are pending cvars for the given flags.
| flags | The CVAR_* flags |
Definition at line 881 of file cvar.cpp.
References cvarVars, and cvar_t::next.
Referenced by R_BeginFrame().
| cvarChangeListener_t * 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 446 of file cvar.cpp.
References cvar_t::changeListener, Com_Printf(), Cvar_FindVar(), Cvar_GetChangeListener(), cvarChangeListener_t::exec, and cvarChangeListener_t::next.
Referenced by CL_Init(), HUD_InitStartup(), R_RegisterSystemVars(), UI_AddCvarListener_f(), and UI_CvarListenerNodeBind().
| void Cvar_RegisterCvarListener | ( | CvarListenerPtr | listener | ) |
Registers a cvar listener.
| listener | The listener callback to register |
Definition at line 406 of file cvar.cpp.
References cvarListeners.
Referenced by GAME_InitStartup().
Sets the cvar value back to the old value.
| cvar | The cvar to reset |
Definition at line 241 of file cvar.cpp.
References Cvar_Set(), Mem_Free, Mem_StrDup, cvar_t::name, and cvar_t::oldString.
Referenced by HUD_CvarCheckMNHud(), and R_CvarGLSLVersionCheck().
| const char * Cvar_Serverinfo | ( | char * | info, |
| size_t | infoSize | ||
| ) |
returns an info string containing all the CVAR_SERVERINFO cvars
returns an info string containing all the CVAR_SERVERINFO cvars
Definition at line 977 of file cvar.cpp.
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, | ||
| ... | |||
| ) |
will create the variable if it doesn't exist
| bool Cvar_SetCheckFunction | ( | const char * | varName, |
| bool(*)(cvar_t *cvar) | check | ||
| ) |
Sets the check functions for a cvar (e.g. Cvar_Assert)
Sets the check functions for a cvar (e.g. Cvar_Assert)
Definition at line 139 of file cvar.cpp.
References cvar_t::check, Com_Printf(), and Cvar_FindVar().
Referenced by HUD_InitStartup(), Qcommon_Init(), R_InitExtensions(), R_RegisterSystemVars(), SV_Init(), and VID_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 671 of file cvar.cpp.
References Cvar_Set().
Referenced by CL_ActorAppear(), CL_ActorDie(), CL_ActorSelectList(), CL_BattlescapeMouseDragging(), CL_BattlescapeRadarGenerateAll(), CL_CameraRoute(), CL_ChangeSkin_f(), CL_CharacterSkillAndScoreCvars(), CL_CheckCameraRoute(), CL_EntPerish(), CL_LevelDown_f(), CL_LevelUp_f(), CL_NextAlien_f(), CL_PrevAlien_f(), CL_ViewCenterAtGridPosition(), Com_DeveloperSet_f(), Cvar_Add_f(), Cvar_AssertValue(), Cvar_Mod_f(), cvar_t_set_value__SWIG_0(), GAME_GetImportData(), HUD_Update(), HUD_UpdateActorCvar(), IN_Frame(), INV_UpdateObject_f(), LE_CenterView(), uiRadioButtonNode::onActivate(), R_BeginFrame(), R_CvarCheckMaxLightmap(), R_CvarPostProcess(), R_CvarPrograms(), R_InitExtensions(), R_SphereInit(), R_UpdateVidDef(), R_VerifyDriver(), SCR_ChangeCursor(), uiAbstractValueNode::setDelta(), uiAbstractValueNode::setMax(), uiAbstractValueNode::setMin(), uiAbstractValueNode::setValue(), SP_worldspawn(), SV_Map_f(), UI_InvalidateStack(), and UI_NodeSetProperty().
Definition at line 1100 of file cvar.cpp.
References cvarVars, cvarVarsHash, and OBJZERO.
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 487 of file cvar.cpp.
References cvar_t::changeListener, Com_Printf(), Cvar_FindVar(), cvarChangeListener_t::exec, Mem_Free, and cvarChangeListener_t::next.
Referenced by CL_Shutdown(), uiCvarNode::onWindowClosed(), and UI_RemoveCvarListener_f().
| void Cvar_UnRegisterCvarListener | ( | CvarListenerPtr | listener | ) |
Unregisters a cvar listener.
| listener | The listener callback to unregister |
Definition at line 415 of file cvar.cpp.
References cvarListeners.
Referenced by GAME_Shutdown().
any CVAR_LATCHED variables that have been set will now take effect
any CVAR_LATCHED variables that have been set will now take effect
Definition at line 683 of file cvar.cpp.
References cvarVars, and cvar_t::next.
Referenced by SV_InitGame().
| const char * Cvar_Userinfo | ( | char * | info, |
| size_t | infoSize | ||
| ) |
returns an info string containing all the CVAR_USERINFO cvars
returns an info string containing all the CVAR_USERINFO cvars
Definition at line 967 of file cvar.cpp.
References Cvar_BitInfo(), and CVAR_USERINFO.
Referenced by CL_Connect(), CL_SendChangedUserinfos(), CL_UserInfo_f(), and TEST_F().
| const char * Cvar_VariableStringOld | ( | const char * | varName | ) |
returns an empty string if not defined
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 226 of file cvar.cpp.
References Cvar_FindVar(), and cvar_t::oldString.
Referenced by GAME_GetImportData().