mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-19 07:30:59 +00:00
Show CVar's default value in addition to current
This commit is contained in:
parent
9fbfee3b2d
commit
da97b51c35
3 changed files with 19 additions and 2 deletions
|
@ -150,6 +150,11 @@ const char *FBaseCVar::GetHumanString(int precision) const
|
||||||
return GetGenericRep(CVAR_String).String;
|
return GetGenericRep(CVAR_String).String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *FBaseCVar::GetHumanStringDefault(int precision) const
|
||||||
|
{
|
||||||
|
return GetGenericRepDefault(CVAR_String).String;
|
||||||
|
}
|
||||||
|
|
||||||
void FBaseCVar::ForceSet (UCVarValue value, ECVarType type, bool nouserinfosend)
|
void FBaseCVar::ForceSet (UCVarValue value, ECVarType type, bool nouserinfosend)
|
||||||
{
|
{
|
||||||
DoSet (value, type);
|
DoSet (value, type);
|
||||||
|
@ -653,6 +658,16 @@ const char *FFloatCVar::GetHumanString(int precision) const
|
||||||
return cstrbuf;
|
return cstrbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *FFloatCVar::GetHumanStringDefault(int precision) const
|
||||||
|
{
|
||||||
|
if (precision < 0)
|
||||||
|
{
|
||||||
|
precision = 6;
|
||||||
|
}
|
||||||
|
mysnprintf(cstrbuf, countof(cstrbuf), "%.*g", precision, DefaultValue);
|
||||||
|
return cstrbuf;
|
||||||
|
}
|
||||||
|
|
||||||
UCVarValue FFloatCVar::GetGenericRep (ECVarType type) const
|
UCVarValue FFloatCVar::GetGenericRep (ECVarType type) const
|
||||||
{
|
{
|
||||||
return FromFloat (Value, type);
|
return FromFloat (Value, type);
|
||||||
|
|
|
@ -161,6 +161,7 @@ public:
|
||||||
virtual UCVarValue GetGenericRep (ECVarType type) const = 0;
|
virtual UCVarValue GetGenericRep (ECVarType type) const = 0;
|
||||||
virtual UCVarValue GetFavoriteRep (ECVarType *type) const = 0;
|
virtual UCVarValue GetFavoriteRep (ECVarType *type) const = 0;
|
||||||
|
|
||||||
|
virtual const char *GetHumanStringDefault(int precision = -1) const;
|
||||||
virtual UCVarValue GetGenericRepDefault (ECVarType type) const = 0;
|
virtual UCVarValue GetGenericRepDefault (ECVarType type) const = 0;
|
||||||
virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const = 0;
|
virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const = 0;
|
||||||
virtual void SetGenericRepDefault (UCVarValue value, ECVarType type) = 0;
|
virtual void SetGenericRepDefault (UCVarValue value, ECVarType type) = 0;
|
||||||
|
@ -339,6 +340,7 @@ public:
|
||||||
virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const override;
|
virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const override;
|
||||||
virtual void SetGenericRepDefault (UCVarValue value, ECVarType type) override;
|
virtual void SetGenericRepDefault (UCVarValue value, ECVarType type) override;
|
||||||
const char *GetHumanString(int precision) const override;
|
const char *GetHumanString(int precision) const override;
|
||||||
|
const char *GetHumanStringDefault(int precision) const override;
|
||||||
|
|
||||||
float operator= (float floatval)
|
float operator= (float floatval)
|
||||||
{ UCVarValue val; val.Float = floatval; SetGenericRep (val, CVAR_Float); return floatval; }
|
{ UCVarValue val; val.Float = floatval; SetGenericRep (val, CVAR_Float); return floatval; }
|
||||||
|
|
|
@ -302,7 +302,8 @@ void C_DoCommand (const char *cmd, int keynum)
|
||||||
else
|
else
|
||||||
{ // Get the variable's value
|
{ // Get the variable's value
|
||||||
if (var->GetDescription().Len()) Printf("%s\n", GStrings.localize(var->GetDescription()));
|
if (var->GetDescription().Len()) Printf("%s\n", GStrings.localize(var->GetDescription()));
|
||||||
Printf ("\"%s\" is \"%s\"\n", var->GetName(), var->GetHumanString());
|
Printf ("\"%s\" is \"%s\" ", var->GetName(), var->GetHumanString());
|
||||||
|
Printf ("(default: \"%s\")\n", var->GetHumanStringDefault());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1149,4 +1150,3 @@ CCMD (pullin)
|
||||||
Printf (TEXTCOLOR_BOLD "Pullin" TEXTCOLOR_NORMAL " is only valid from .cfg\n"
|
Printf (TEXTCOLOR_BOLD "Pullin" TEXTCOLOR_NORMAL " is only valid from .cfg\n"
|
||||||
"files and only when used at startup.\n");
|
"files and only when used at startup.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue