This repository has been archived on 2022-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
Xash3DArchive/engine/common/cvar.h

62 lines
2.3 KiB
C

//=======================================================================
// Copyright XashXT Group 2007 ©
// cvar.h - console variables
//=======================================================================
#ifndef CVAR_H
#define CVAR_H
extern cvar_t *cvar_vars;
cvar_t *Cvar_FindVar (const char *var_name);
cvar_t *Cvar_Get (const char *var_name, const char *value, int flags);
// 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
#define Cvar_Set(name, val) _Cvar_Set (name, val, __FILE__, __LINE__)
cvar_t *_Cvar_Set (const char *var_name, const char *value, const char *filename, int fileline);
// will create the variable if it doesn't exist
cvar_t *Cvar_ForceSet (const char *var_name, const char *value);
// will set the variable even if NOSET or LATCH
cvar_t *Cvar_FullSet (char *var_name, char *value, int flags);
void Cvar_SetValue (char *var_name, float value);
// expands value to a string and calls Cvar_Set
float Cvar_VariableValue (const char *var_name);
// returns 0 if not defined or non numeric
char *Cvar_VariableString (const char *var_name);
// returns an empty string if not defined
char *Cvar_CompleteVariable (char *partial);
// attempts to match a partial variable name for command line completion
// returns NULL if nothing fits
void Cvar_GetLatchedVars (void);
// any CVAR_LATCHED variables that have been set will now take effect
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)
void Cvar_WriteVariables (char *path);
// appends lines containing "set variable value" for all variables
// with the archive flag set to true.
void Cvar_Init (void);
char *Cvar_Userinfo (void);
// returns an info string containing all the CVAR_USERINFO cvars
char *Cvar_Serverinfo (void);
// returns an info string containing all the CVAR_SERVERINFO cvars
extern bool userinfo_modified;
// this is set each time a CVAR_USERINFO variable is changed
// so that the client knows to send it to the server
#endif//CVAR_H