- Changed C_ArchiveCVars()'s type parameter to a filter parameter, because using an arbitrary

number to represent a flag combination is stupid unreadable now that there's more than just
  the two possibilities it had when it was first written.

SVN r4278 (trunk)
This commit is contained in:
Randy Heit 2013-05-25 03:23:44 +00:00
parent 20b48b7c65
commit e271692dbb
3 changed files with 9 additions and 28 deletions

View file

@ -1533,28 +1533,9 @@ void C_SetCVarsToDefaults (void)
}
}
void C_ArchiveCVars (FConfigFile *f, int type)
void C_ArchiveCVars (FConfigFile *f, uint32 filter)
{
// type 0: Game-specific cvars
// type 1: Global cvars
// type 2: Unknown cvars
// type 3: Unknown global cvars
// type 4: User info cvars
// type 5: Server info cvars
static const DWORD filters[6] =
{
CVAR_ARCHIVE,
CVAR_ARCHIVE|CVAR_GLOBALCONFIG,
CVAR_ARCHIVE|CVAR_AUTO,
CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_AUTO,
CVAR_ARCHIVE|CVAR_USERINFO,
CVAR_ARCHIVE|CVAR_SERVERINFO
};
FBaseCVar *cvar = CVars;
DWORD filter;
filter = filters[type];
while (cvar)
{

View file

@ -157,7 +157,7 @@ private:
friend FBaseCVar *FindCVar (const char *var_name, FBaseCVar **prev);
friend FBaseCVar *FindCVarSub (const char *var_name, int namelen);
friend void UnlatchCVars (void);
friend void C_ArchiveCVars (FConfigFile *f, int type);
friend void C_ArchiveCVars (FConfigFile *f, uint32 filter);
friend void C_SetCVarsToDefaults (void);
friend void FilterCompactCVars (TArray<FBaseCVar *> &cvars, uint32 filter);
friend void C_DeinitConsole();
@ -189,7 +189,7 @@ FBaseCVar *C_CreateCVar(const char *var_name, ECVarType var_type, DWORD flags);
void UnlatchCVars (void);
// archive cvars to FILE f
void C_ArchiveCVars (FConfigFile *f, int type);
void C_ArchiveCVars (FConfigFile *f, uint32 filter);
// initialize cvars to default values after they are created
void C_SetCVarsToDefaults (void);

View file

@ -483,12 +483,12 @@ void FGameConfigFile::ArchiveGameData (const char *gamename)
strncpy (subsection, "Player", sublen);
SetSection (section, true);
ClearCurrentSection ();
C_ArchiveCVars (this, 4);
C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_USERINFO);
strncpy (subsection, "ConsoleVariables", sublen);
SetSection (section, true);
ClearCurrentSection ();
C_ArchiveCVars (this, 0);
C_ArchiveCVars (this, CVAR_ARCHIVE);
strncpy (subsection, netgame ? "NetServerInfo" : "LocalServerInfo", sublen);
if (!netgame || consoleplayer == 0)
@ -496,13 +496,13 @@ void FGameConfigFile::ArchiveGameData (const char *gamename)
// this machine was not the initial host.
SetSection (section, true);
ClearCurrentSection ();
C_ArchiveCVars (this, 5);
C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_SERVERINFO);
}
strncpy (subsection, "UnknownConsoleVariables", sublen);
SetSection (section, true);
ClearCurrentSection ();
C_ArchiveCVars (this, 2);
C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_AUTO);
strncpy (subsection, "ConsoleAliases", sublen);
SetSection (section, true);
@ -532,11 +532,11 @@ void FGameConfigFile::ArchiveGlobalData ()
SetSection ("GlobalSettings", true);
ClearCurrentSection ();
C_ArchiveCVars (this, 1);
C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
SetSection ("GlobalSettings.Unknown", true);
ClearCurrentSection ();
C_ArchiveCVars (this, 3);
C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_AUTO);
}
FString FGameConfigFile::GetConfigPath (bool tryProg)