diff --git a/src/command.c b/src/command.c index 520b1dc48..69dbc80a0 100644 --- a/src/command.c +++ b/src/command.c @@ -1374,9 +1374,9 @@ static const char *cv_null_string = ""; * * \param name Variable to search for. * \return Pointer to the variable if found, or NULL. - * \sa CV_FindNetVar + * \sa CV_FindVar */ -consvar_t *CV_FindVar(const char *name) +static consvar_t *CV_FindVarInternal(const char *name) { consvar_t *cvar; @@ -1387,6 +1387,22 @@ consvar_t *CV_FindVar(const char *name) return NULL; } +/** Searches if a variable has been registered and is visible to the console. + * + * \param name Variable to search for. + * \return Pointer to the variable if found, or NULL. + * \sa CV_FindVarInternal + */ +consvar_t *CV_FindVar(const char *name) +{ + consvar_t *cvar = CV_FindVarInternal(name); + + if (cvar && (cvar->flags & CV_NOSHOWHELP)) + return NULL; + + return cvar; +} + /** Finds a net variable based on its identifier number. * * \param netid The variable's identifier number. @@ -1418,7 +1434,7 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth); void CV_RegisterVar(consvar_t *variable) { // first check to see if it has already been defined - if (CV_FindVar(variable->name)) + if (CV_FindVarInternal(variable->name)) { CONS_Printf(M_GetText("Variable %s is already defined\n"), variable->name); return; @@ -1792,7 +1808,7 @@ ReadDemoVar (const UINT8 **p, const char **return_value, boolean *return_stealth SKIPSTRING (*p); stealth = READUINT8 (*p); - cvar = CV_FindVar(name); + cvar = CV_FindVarInternal(name); if (cvar) { diff --git a/src/command.h b/src/command.h index 74fc49708..61d211987 100644 --- a/src/command.h +++ b/src/command.h @@ -134,7 +134,7 @@ typedef enum CV_MODIFIED = 64, // this bit is set when cvar is modified CV_SHOWMODIF = 128, // say something when modified CV_SHOWMODIFONETIME = 256, // same but will be reset to 0 when modified, set in toggle - CV_NOSHOWHELP = 512, // Don't show variable in the HELP list Tails 08-13-2002 + CV_NOSHOWHELP = 512, // Cannot be accessed by the console, but it still exists in the cvar list CV_HIDDEN = 1024, // variable is not part of the cvar list so cannot be accessed by the console // can only be set when we have the pointer to it // used on menus