- Added CVARINFO lump support. This is a lump for defining mod-specific cvars and takes entries
of the form:
<scope> [noarchive] <type> <name> [= <defaultvalue>];
Where <scope> is one of:
* server: This cvar is shared by all players, and in network games, only select players can
change it.
* user: Each player has their own copy of this cvar, which they can change independently.
To prevent the cvar from being written to the config file, add noarchive to its definition.
<Type> is one of:
* int: An integral value. Defaults to 0.
* float: A value that can include a fraction. Defaults to 0.0.
* color: A color value. Default to black ("00 00 00").
* bool: A boolean value that can hold either true or false. Defaults to false.
* string: A string value. It's not too useful for mods but is included for completeness. Defaults to "".
<Name> is the cvar's name and must begin with a letter and may only include alphanumeric
characters and the underscore character.
If you wish a non-standard default add an = character after the cvar's name followed by the
default value you want to use. Example:
server int mymod_coolness = 10;
- Fixed: FStringCVar::SetGenericRepDefault() did not make a copy of the input string.
SVN r4280 (trunk)
This commit is contained in:
parent
2767f31a92
commit
787b84ef91
8 changed files with 214 additions and 40 deletions
|
|
@ -135,7 +135,7 @@ FBaseCVar::~FBaseCVar ()
|
|||
void FBaseCVar::ForceSet (UCVarValue value, ECVarType type)
|
||||
{
|
||||
DoSet (value, type);
|
||||
if (Flags & CVAR_USERINFO)
|
||||
if ((Flags & CVAR_USERINFO) && !(Flags & CVAR_NOSEND))
|
||||
D_UserInfoChanged (this);
|
||||
if (m_UseCallback)
|
||||
Callback ();
|
||||
|
|
@ -849,9 +849,7 @@ UCVarValue FStringCVar::GetFavoriteRepDefault (ECVarType *type) const
|
|||
|
||||
void FStringCVar::SetGenericRepDefault (UCVarValue value, ECVarType type)
|
||||
{
|
||||
if (DefaultValue)
|
||||
delete[] DefaultValue;
|
||||
DefaultValue = ToString (value, type);
|
||||
ReplaceString(&DefaultValue, ToString(value, type));
|
||||
if (Flags & CVAR_ISDEFAULT)
|
||||
{
|
||||
SetGenericRep (value, type);
|
||||
|
|
@ -1277,7 +1275,7 @@ void FilterCompactCVars (TArray<FBaseCVar *> &cvars, DWORD filter)
|
|||
// Accumulate all cvars that match the filter flags.
|
||||
for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->m_Next)
|
||||
{
|
||||
if (cvar->Flags & filter)
|
||||
if ((cvar->Flags & filter) && !(cvar->Flags & CVAR_NOSEND))
|
||||
cvars.Push(cvar);
|
||||
}
|
||||
// Now sort them, so they're in a deterministic order and not whatever
|
||||
|
|
@ -1316,7 +1314,7 @@ FString C_GetMassCVarString (DWORD filter, bool compact)
|
|||
{
|
||||
for (cvar = CVars; cvar != NULL; cvar = cvar->m_Next)
|
||||
{
|
||||
if ((cvar->Flags & filter) && !(cvar->Flags & CVAR_NOSAVE))
|
||||
if ((cvar->Flags & filter) && !(cvar->Flags & (CVAR_NOSAVE|CVAR_NOSEND)))
|
||||
{
|
||||
UCVarValue val = cvar->GetGenericRep(CVAR_String);
|
||||
dump << '\\' << cvar->GetName() << '\\' << val.String;
|
||||
|
|
@ -1489,6 +1487,7 @@ FBaseCVar *FindCVarSub (const char *var_name, int namelen)
|
|||
FBaseCVar *C_CreateCVar(const char *var_name, ECVarType var_type, DWORD flags)
|
||||
{
|
||||
assert(FindCVar(var_name, NULL) == NULL);
|
||||
flags |= CVAR_AUTO;
|
||||
switch (var_type)
|
||||
{
|
||||
case CVAR_Bool: return new FBoolCVar(var_name, 0, flags);
|
||||
|
|
@ -1540,7 +1539,7 @@ void C_ArchiveCVars (FConfigFile *f, uint32 filter)
|
|||
while (cvar)
|
||||
{
|
||||
if ((cvar->Flags &
|
||||
(CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_AUTO|CVAR_USERINFO|CVAR_SERVERINFO|CVAR_NOSAVE))
|
||||
(CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_MODARCHIVE|CVAR_AUTO|CVAR_USERINFO|CVAR_SERVERINFO|CVAR_NOSAVE))
|
||||
== filter)
|
||||
{
|
||||
UCVarValue val;
|
||||
|
|
@ -1671,14 +1670,16 @@ void FBaseCVar::ListVars (const char *filter, bool plain)
|
|||
else
|
||||
{
|
||||
++count;
|
||||
Printf ("%c%c%c %s : :%s\n",
|
||||
flags & CVAR_ARCHIVE ? 'A' : ' ',
|
||||
Printf ("%c%c%c%c %s = %s\n",
|
||||
flags & CVAR_ARCHIVE ? 'A' :
|
||||
flags & CVAR_MODARCHIVE ? 'M' : ' ',
|
||||
flags & CVAR_USERINFO ? 'U' :
|
||||
flags & CVAR_SERVERINFO ? 'S' :
|
||||
flags & CVAR_AUTO ? 'C' : ' ',
|
||||
flags & CVAR_SERVERINFO ? 'S' :
|
||||
flags & CVAR_AUTO ? 'C' : ' ',
|
||||
flags & CVAR_NOSET ? '-' :
|
||||
flags & CVAR_LATCH ? 'L' :
|
||||
flags & CVAR_UNSETTABLE ? '*' : ' ',
|
||||
flags & CVAR_LATCH ? 'L' :
|
||||
flags & CVAR_UNSETTABLE ? '*' : ' ',
|
||||
flags & CVAR_NOSEND ? 'X' : ' ',
|
||||
var->GetName(),
|
||||
var->GetGenericRep (CVAR_String).String);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue