mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-01-18 21:21:36 +00:00
- Renamed CVAR_NOSEND to CVAR_IGNORE to better reflect its intent.
- Separated CVAR_MODARCHIVE into CVAR_MOD|CVAR_ARCHIVE so that mod-defined cvars can still be identified when they aren't meant to be archived. SVN r4281 (trunk)
This commit is contained in:
parent
787b84ef91
commit
4fa198244c
6 changed files with 21 additions and 25 deletions
|
@ -135,7 +135,7 @@ FBaseCVar::~FBaseCVar ()
|
||||||
void FBaseCVar::ForceSet (UCVarValue value, ECVarType type)
|
void FBaseCVar::ForceSet (UCVarValue value, ECVarType type)
|
||||||
{
|
{
|
||||||
DoSet (value, type);
|
DoSet (value, type);
|
||||||
if ((Flags & CVAR_USERINFO) && !(Flags & CVAR_NOSEND))
|
if ((Flags & CVAR_USERINFO) && !(Flags & CVAR_IGNORE))
|
||||||
D_UserInfoChanged (this);
|
D_UserInfoChanged (this);
|
||||||
if (m_UseCallback)
|
if (m_UseCallback)
|
||||||
Callback ();
|
Callback ();
|
||||||
|
@ -1275,7 +1275,7 @@ void FilterCompactCVars (TArray<FBaseCVar *> &cvars, DWORD filter)
|
||||||
// Accumulate all cvars that match the filter flags.
|
// Accumulate all cvars that match the filter flags.
|
||||||
for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->m_Next)
|
for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->m_Next)
|
||||||
{
|
{
|
||||||
if ((cvar->Flags & filter) && !(cvar->Flags & CVAR_NOSEND))
|
if ((cvar->Flags & filter) && !(cvar->Flags & CVAR_IGNORE))
|
||||||
cvars.Push(cvar);
|
cvars.Push(cvar);
|
||||||
}
|
}
|
||||||
// Now sort them, so they're in a deterministic order and not whatever
|
// Now sort them, so they're in a deterministic order and not whatever
|
||||||
|
@ -1314,7 +1314,7 @@ FString C_GetMassCVarString (DWORD filter, bool compact)
|
||||||
{
|
{
|
||||||
for (cvar = CVars; cvar != NULL; cvar = cvar->m_Next)
|
for (cvar = CVars; cvar != NULL; cvar = cvar->m_Next)
|
||||||
{
|
{
|
||||||
if ((cvar->Flags & filter) && !(cvar->Flags & (CVAR_NOSAVE|CVAR_NOSEND)))
|
if ((cvar->Flags & filter) && !(cvar->Flags & (CVAR_NOSAVE|CVAR_IGNORE)))
|
||||||
{
|
{
|
||||||
UCVarValue val = cvar->GetGenericRep(CVAR_String);
|
UCVarValue val = cvar->GetGenericRep(CVAR_String);
|
||||||
dump << '\\' << cvar->GetName() << '\\' << val.String;
|
dump << '\\' << cvar->GetName() << '\\' << val.String;
|
||||||
|
@ -1539,7 +1539,7 @@ void C_ArchiveCVars (FConfigFile *f, uint32 filter)
|
||||||
while (cvar)
|
while (cvar)
|
||||||
{
|
{
|
||||||
if ((cvar->Flags &
|
if ((cvar->Flags &
|
||||||
(CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_MODARCHIVE|CVAR_AUTO|CVAR_USERINFO|CVAR_SERVERINFO|CVAR_NOSAVE))
|
(CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_MOD|CVAR_AUTO|CVAR_USERINFO|CVAR_SERVERINFO|CVAR_NOSAVE))
|
||||||
== filter)
|
== filter)
|
||||||
{
|
{
|
||||||
UCVarValue val;
|
UCVarValue val;
|
||||||
|
@ -1670,16 +1670,16 @@ void FBaseCVar::ListVars (const char *filter, bool plain)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
++count;
|
++count;
|
||||||
Printf ("%c%c%c%c %s = %s\n",
|
Printf ("%c%c%c%c%c %s = %s\n",
|
||||||
flags & CVAR_ARCHIVE ? 'A' :
|
flags & CVAR_ARCHIVE ? 'A' : ' ',
|
||||||
flags & CVAR_MODARCHIVE ? 'M' : ' ',
|
|
||||||
flags & CVAR_USERINFO ? 'U' :
|
flags & CVAR_USERINFO ? 'U' :
|
||||||
flags & CVAR_SERVERINFO ? 'S' :
|
flags & CVAR_SERVERINFO ? 'S' :
|
||||||
flags & CVAR_AUTO ? 'C' : ' ',
|
flags & CVAR_AUTO ? 'C' : ' ',
|
||||||
flags & CVAR_NOSET ? '-' :
|
flags & CVAR_NOSET ? '-' :
|
||||||
flags & CVAR_LATCH ? 'L' :
|
flags & CVAR_LATCH ? 'L' :
|
||||||
flags & CVAR_UNSETTABLE ? '*' : ' ',
|
flags & CVAR_UNSETTABLE ? '*' : ' ',
|
||||||
flags & CVAR_NOSEND ? 'X' : ' ',
|
flags & CVAR_MOD ? 'M' : ' ',
|
||||||
|
flags & CVAR_IGNORE ? 'X' : ' ',
|
||||||
var->GetName(),
|
var->GetName(),
|
||||||
var->GetGenericRep (CVAR_String).String);
|
var->GetGenericRep (CVAR_String).String);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,8 @@ enum
|
||||||
CVAR_GLOBALCONFIG = 1024, // cvar is saved to global config section
|
CVAR_GLOBALCONFIG = 1024, // cvar is saved to global config section
|
||||||
CVAR_VIDEOCONFIG = 2048, // cvar is saved to video config section (not implemented)
|
CVAR_VIDEOCONFIG = 2048, // cvar is saved to video config section (not implemented)
|
||||||
CVAR_NOSAVE = 4096, // when used with CVAR_SERVERINFO, do not save var to savegame
|
CVAR_NOSAVE = 4096, // when used with CVAR_SERVERINFO, do not save var to savegame
|
||||||
CVAR_MODARCHIVE = 8192, // cvar will be saved to a mod-specific section of the ini
|
CVAR_MOD = 8192, // cvar was defined by a mod
|
||||||
CVAR_NOSEND = 16384,// do not send cvar across the network (dummy mod cvar)
|
CVAR_IGNORE = 16384,// do not send cvar across the network/inaccesible from ACS (dummy mod cvar)
|
||||||
};
|
};
|
||||||
|
|
||||||
union UCVarValue
|
union UCVarValue
|
||||||
|
|
|
@ -1379,7 +1379,7 @@ void ParseCVarInfo()
|
||||||
FString cvarname;
|
FString cvarname;
|
||||||
char *cvardefault = NULL;
|
char *cvardefault = NULL;
|
||||||
ECVarType cvartype = CVAR_Dummy;
|
ECVarType cvartype = CVAR_Dummy;
|
||||||
int cvarflags = CVAR_MODARCHIVE;
|
int cvarflags = CVAR_MOD|CVAR_ARCHIVE;
|
||||||
FBaseCVar *cvar;
|
FBaseCVar *cvar;
|
||||||
|
|
||||||
// Check for flag tokens.
|
// Check for flag tokens.
|
||||||
|
@ -1395,7 +1395,7 @@ void ParseCVarInfo()
|
||||||
}
|
}
|
||||||
else if (stricmp(sc.String, "noarchive") == 0)
|
else if (stricmp(sc.String, "noarchive") == 0)
|
||||||
{
|
{
|
||||||
cvarflags &= ~CVAR_MODARCHIVE;
|
cvarflags &= ~CVAR_ARCHIVE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -378,7 +378,7 @@ void D_SetupUserInfo ()
|
||||||
|
|
||||||
for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->GetNext())
|
for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->GetNext())
|
||||||
{
|
{
|
||||||
if ((cvar->GetFlags() & (CVAR_USERINFO|CVAR_NOSEND)) == CVAR_USERINFO)
|
if ((cvar->GetFlags() & (CVAR_USERINFO|CVAR_IGNORE)) == CVAR_USERINFO)
|
||||||
{
|
{
|
||||||
FBaseCVar **newcvar;
|
FBaseCVar **newcvar;
|
||||||
FName cvarname(cvar->GetName());
|
FName cvarname(cvar->GetName());
|
||||||
|
@ -416,7 +416,7 @@ void userinfo_t::Reset()
|
||||||
// Create userinfo vars for this player, initialized to their defaults.
|
// Create userinfo vars for this player, initialized to their defaults.
|
||||||
for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->GetNext())
|
for (FBaseCVar *cvar = CVars; cvar != NULL; cvar = cvar->GetNext())
|
||||||
{
|
{
|
||||||
if ((cvar->GetFlags() & (CVAR_USERINFO|CVAR_NOSEND)) == CVAR_USERINFO)
|
if ((cvar->GetFlags() & (CVAR_USERINFO|CVAR_IGNORE)) == CVAR_USERINFO)
|
||||||
{
|
{
|
||||||
ECVarType type;
|
ECVarType type;
|
||||||
FName cvarname(cvar->GetName());
|
FName cvarname(cvar->GetName());
|
||||||
|
|
|
@ -453,12 +453,12 @@ void FGameConfigFile::DoModSetup(const char *gamename)
|
||||||
mysnprintf(section, countof(section), "%s.Player.Mod", gamename);
|
mysnprintf(section, countof(section), "%s.Player.Mod", gamename);
|
||||||
if (SetSection(section))
|
if (SetSection(section))
|
||||||
{
|
{
|
||||||
ReadCVars(CVAR_MODARCHIVE|CVAR_USERINFO|CVAR_NOSEND);
|
ReadCVars(CVAR_MOD|CVAR_USERINFO|CVAR_IGNORE);
|
||||||
}
|
}
|
||||||
mysnprintf(section, countof(section), "%s.LocalServerInfo.Mod", gamename);
|
mysnprintf(section, countof(section), "%s.LocalServerInfo.Mod", gamename);
|
||||||
if (SetSection (section))
|
if (SetSection (section))
|
||||||
{
|
{
|
||||||
ReadCVars (CVAR_MODARCHIVE|CVAR_SERVERINFO|CVAR_NOSEND);
|
ReadCVars (CVAR_MOD|CVAR_SERVERINFO|CVAR_IGNORE);
|
||||||
}
|
}
|
||||||
// Signal that these sections should be rewritten when saving the config.
|
// Signal that these sections should be rewritten when saving the config.
|
||||||
bModSetup = true;
|
bModSetup = true;
|
||||||
|
@ -476,7 +476,7 @@ void FGameConfigFile::ReadNetVars ()
|
||||||
mysnprintf(subsection, sublen, "NetServerInfo.Mod");
|
mysnprintf(subsection, sublen, "NetServerInfo.Mod");
|
||||||
if (SetSection(section))
|
if (SetSection(section))
|
||||||
{
|
{
|
||||||
ReadCVars(CVAR_MODARCHIVE|CVAR_SERVERINFO|CVAR_NOSEND);
|
ReadCVars(CVAR_MOD|CVAR_SERVERINFO|CVAR_IGNORE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,11 +489,7 @@ void FGameConfigFile::ReadCVars (DWORD flags)
|
||||||
FBaseCVar *cvar;
|
FBaseCVar *cvar;
|
||||||
UCVarValue val;
|
UCVarValue val;
|
||||||
|
|
||||||
if (!(flags & CVAR_MODARCHIVE))
|
flags |= CVAR_ARCHIVE|CVAR_UNSETTABLE|CVAR_AUTO;
|
||||||
{
|
|
||||||
flags |= CVAR_ARCHIVE|CVAR_UNSETTABLE;
|
|
||||||
}
|
|
||||||
flags |= CVAR_AUTO;
|
|
||||||
while (NextInSection (key, value))
|
while (NextInSection (key, value))
|
||||||
{
|
{
|
||||||
cvar = FindCVar (key, NULL);
|
cvar = FindCVar (key, NULL);
|
||||||
|
@ -523,7 +519,7 @@ void FGameConfigFile::ArchiveGameData (const char *gamename)
|
||||||
strncpy (subsection + 6, ".Mod", sublen - 6);
|
strncpy (subsection + 6, ".Mod", sublen - 6);
|
||||||
SetSection (section, true);
|
SetSection (section, true);
|
||||||
ClearCurrentSection ();
|
ClearCurrentSection ();
|
||||||
C_ArchiveCVars (this, CVAR_MODARCHIVE|CVAR_AUTO|CVAR_USERINFO);
|
C_ArchiveCVars (this, CVAR_MOD|CVAR_ARCHIVE|CVAR_AUTO|CVAR_USERINFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy (subsection, "ConsoleVariables", sublen);
|
strncpy (subsection, "ConsoleVariables", sublen);
|
||||||
|
@ -545,7 +541,7 @@ void FGameConfigFile::ArchiveGameData (const char *gamename)
|
||||||
strncpy (subsection, netgame ? "NetServerInfo.Mod" : "LocalServerInfo.Mod", sublen);
|
strncpy (subsection, netgame ? "NetServerInfo.Mod" : "LocalServerInfo.Mod", sublen);
|
||||||
SetSection (section, true);
|
SetSection (section, true);
|
||||||
ClearCurrentSection ();
|
ClearCurrentSection ();
|
||||||
C_ArchiveCVars (this, CVAR_MODARCHIVE|CVAR_AUTO|CVAR_SERVERINFO);
|
C_ArchiveCVars (this, CVAR_MOD|CVAR_ARCHIVE|CVAR_AUTO|CVAR_SERVERINFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6886,7 +6886,7 @@ scriptwait:
|
||||||
{
|
{
|
||||||
FBaseCVar *cvar = FindCVar (FBehavior::StaticLookupString (STACK(1)), NULL);
|
FBaseCVar *cvar = FindCVar (FBehavior::StaticLookupString (STACK(1)), NULL);
|
||||||
// Either the cvar doesn't exist, or it's for a mod that isn't loaded, so return 0.
|
// Either the cvar doesn't exist, or it's for a mod that isn't loaded, so return 0.
|
||||||
if (cvar == NULL || (cvar->GetFlags() & CVAR_NOSEND))
|
if (cvar == NULL || (cvar->GetFlags() & CVAR_IGNORE))
|
||||||
{
|
{
|
||||||
STACK(1) = 0;
|
STACK(1) = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue