summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/cl_main.c1
-rw-r--r--src/qcommon/common.c1
-rw-r--r--src/qcommon/cvar.c24
-rw-r--r--src/qcommon/q_shared.h1
-rw-r--r--src/qcommon/qcommon.h1
-rw-r--r--src/renderercommon/tr_public.h1
6 files changed, 29 insertions, 0 deletions
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
index 6bcf3a7f..03bd542c 100644
--- a/src/client/cl_main.c
+++ b/src/client/cl_main.c
@@ -3303,6 +3303,7 @@ void CL_InitRef( void ) {
ri.Cvar_Set = Cvar_Set;
ri.Cvar_SetValue = Cvar_SetValue;
ri.Cvar_CheckRange = Cvar_CheckRange;
+ ri.Cvar_SetDescription = Cvar_SetDescription;
ri.Cvar_VariableIntegerValue = Cvar_VariableIntegerValue;
// cinematic stuff
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index d8216b15..74df47ba 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -1533,6 +1533,7 @@ void Com_InitHunkMemory( void ) {
// allocate the stack based hunk allocator
cv = Cvar_Get( "com_hunkMegs", DEF_COMHUNKMEGS_S, CVAR_LATCH | CVAR_ARCHIVE );
+ Cvar_SetDescription(cv, "The size of the hunk memory segment");
// if we are not dedicated min allocation is 56, otherwise min is 1
if (com_dedicated && com_dedicated->integer) {
diff --git a/src/qcommon/cvar.c b/src/qcommon/cvar.c
index 93ab6ae8..336f45b0 100644
--- a/src/qcommon/cvar.c
+++ b/src/qcommon/cvar.c
@@ -439,6 +439,7 @@ cvar_t *Cvar_Get( const char *var_name, const char *var_value, int flags ) {
var->integer = atoi(var->string);
var->resetString = CopyString( var_value );
var->validate = qfalse;
+ var->description = NULL;
// link the variable in
var->next = cvar_vars;
@@ -490,6 +491,10 @@ void Cvar_Print( cvar_t *v ) {
if ( v->latchedString ) {
Com_Printf( "latched: \"%s\"\n", v->latchedString );
}
+
+ if ( v->description ) {
+ Com_Printf( "%s\n", v->description );
+ }
}
/*
@@ -1121,6 +1126,8 @@ cvar_t *Cvar_Unset(cvar_t *cv)
Z_Free(cv->latchedString);
if(cv->resetString)
Z_Free(cv->resetString);
+ if(cv->description)
+ Z_Free(cv->description);
if(cv->prev)
cv->prev->next = cv->next;
@@ -1292,6 +1299,23 @@ void Cvar_CheckRange( cvar_t *var, float min, float max, qboolean integral )
/*
=====================
+Cvar_SetDescription
+=====================
+*/
+void Cvar_SetDescription( cvar_t *var, const char *var_description )
+{
+ if( var_description && var_description[0] != '\0' )
+ {
+ if( var->description != NULL )
+ {
+ Z_Free( var->description );
+ }
+ var->description = CopyString( var_description );
+ }
+}
+
+/*
+=====================
Cvar_Register
basically a slightly modified Cvar_Get for the interpreted modules
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index 9de2d8f2..259300ed 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -979,6 +979,7 @@ struct cvar_s {
qboolean integral;
float min;
float max;
+ char *description;
cvar_t *next;
cvar_t *prev;
diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h
index 5ee2c7c9..98d1f1ec 100644
--- a/src/qcommon/qcommon.h
+++ b/src/qcommon/qcommon.h
@@ -544,6 +544,7 @@ char *Cvar_InfoString_Big( int bit );
// in their flags ( CVAR_USERINFO, CVAR_SERVERINFO, CVAR_SYSTEMINFO, etc )
void Cvar_InfoStringBuffer( int bit, char *buff, int buffsize );
void Cvar_CheckRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
+void Cvar_SetDescription( cvar_t *var, const char *var_description );
void Cvar_Restart(qboolean unsetVM);
void Cvar_Restart_f( void );
diff --git a/src/renderercommon/tr_public.h b/src/renderercommon/tr_public.h
index af422b31..995133e9 100644
--- a/src/renderercommon/tr_public.h
+++ b/src/renderercommon/tr_public.h
@@ -135,6 +135,7 @@ typedef struct {
void (*Cvar_Set)( const char *name, const char *value );
void (*Cvar_SetValue) (const char *name, float value);
void (*Cvar_CheckRange)( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
+ void (*Cvar_SetDescription)( cvar_t *cv, const char *description );
int (*Cvar_VariableIntegerValue) (const char *var_name);