Add facility to describe cvars
This commit is contained in:
parent
f9c202f83e
commit
f83334d81b
6 changed files with 29 additions and 0 deletions
|
@ -438,6 +438,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;
|
||||
|
@ -489,6 +490,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 );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1036,6 +1041,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;
|
||||
|
@ -1205,6 +1212,23 @@ void Cvar_CheckRange( cvar_t *var, float min, float max, qboolean integral )
|
|||
Cvar_Set( var->name, var->string );
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue