Added 'cvarhelp' cmd to retrieve cvar descriptions.

This commit is contained in:
Dan Olson 2000-03-02 22:56:25 +00:00
parent 8b18f9d56b
commit b5c3300cf3
4 changed files with 26 additions and 6 deletions

View file

@ -1739,8 +1739,8 @@ void CL_InitCvars()
//
// register our cvars
//
show_fps = Cvar_Get ("show_fps","0",0,"None");
host_speeds = Cvar_Get ("host_speeds","0",0,"None");
show_fps = Cvar_Get ("show_fps","0",0,"None");
developer = Cvar_Get ("developer","0",0,"None");
sys_nostdout = Cvar_Get ("sys_nostdout","0",0,"None");

View file

@ -30,10 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <cmd.h>
#include <client.h>
#include <stdlib.h>
#ifdef UQUAKE
#include <server.h>
#endif
#if defined(QUAKEWORLD) && defined(SERVERONLY)
#if defined(UQUAKE) || defined(SERVERONLY)
#include <server.h>
#endif
#include <string.h>
@ -269,10 +266,30 @@ void Cvar_Set_f(void)
"User created cvar");
}
}
void Cvar_Help_f (void)
{
char *cvar_name;
cvar_t *var;
if (Cmd_Argc() != 2)
{
Con_Printf ("usage: cvarhelp <cvar>\n");
return;
}
cvar_name = Cmd_Argv (1);
if((var = Cvar_FindVar(cvar_name)) != NULL)
{
Con_Printf ("%s\n",var->description);
return;
}
Con_Printf ("variable not found\n");
}
void Cvar_Init()
{
Cmd_AddCommand ("set", Cvar_Set_f);
Cmd_AddCommand ("cvarhelp",Cvar_Help_f);
}
void Cvar_Shutdown (void)
@ -319,5 +336,6 @@ cvar_t *Cvar_Get(char *name, char *string, int cvarflags, char *description)
}
// Cvar does exist, so we update the flags and return.
v->flags |= cvarflags;
v->flags ^= CVAR_USER_CREATED;
return v;
}

View file

@ -560,8 +560,9 @@ Host_Init (quakeparms_t *parms)
CL_InitCvars();
SCR_InitCvars();
VID_InitCvars ();
Cbuf_Init ();
Cbuf_Init ();
Cmd_Init ();
Cvar_Init ();
V_Init ();
#ifdef QUAKEWORLD

View file

@ -1740,6 +1740,7 @@ void SV_Init (quakeparms_t *parms)
SV_InitCvars ();
Cbuf_Init ();
Cmd_Init ();
Cvar_Init ();
COM_Init ();