mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Prevent CV_NOSHOWHELP cvars from being accessed or modified through the console at all
This commit is contained in:
parent
f7f98ff6d1
commit
a9e181cde5
2 changed files with 21 additions and 5 deletions
|
|
@ -1374,9 +1374,9 @@ static const char *cv_null_string = "";
|
||||||
*
|
*
|
||||||
* \param name Variable to search for.
|
* \param name Variable to search for.
|
||||||
* \return Pointer to the variable if found, or NULL.
|
* \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;
|
consvar_t *cvar;
|
||||||
|
|
||||||
|
|
@ -1387,6 +1387,22 @@ consvar_t *CV_FindVar(const char *name)
|
||||||
return NULL;
|
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.
|
/** Finds a net variable based on its identifier number.
|
||||||
*
|
*
|
||||||
* \param netid The variable's 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)
|
void CV_RegisterVar(consvar_t *variable)
|
||||||
{
|
{
|
||||||
// first check to see if it has already been defined
|
// 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);
|
CONS_Printf(M_GetText("Variable %s is already defined\n"), variable->name);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1792,7 +1808,7 @@ ReadDemoVar (const UINT8 **p, const char **return_value, boolean *return_stealth
|
||||||
SKIPSTRING (*p);
|
SKIPSTRING (*p);
|
||||||
stealth = READUINT8 (*p);
|
stealth = READUINT8 (*p);
|
||||||
|
|
||||||
cvar = CV_FindVar(name);
|
cvar = CV_FindVarInternal(name);
|
||||||
|
|
||||||
if (cvar)
|
if (cvar)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ typedef enum
|
||||||
CV_MODIFIED = 64, // this bit is set when cvar is modified
|
CV_MODIFIED = 64, // this bit is set when cvar is modified
|
||||||
CV_SHOWMODIF = 128, // say something when modified
|
CV_SHOWMODIF = 128, // say something when modified
|
||||||
CV_SHOWMODIFONETIME = 256, // same but will be reset to 0 when modified, set in toggle
|
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
|
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
|
// can only be set when we have the pointer to it
|
||||||
// used on menus
|
// used on menus
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue