From e271692dbbca3c517b2e97b114318e103f338291 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 25 May 2013 03:23:44 +0000 Subject: [PATCH] - 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) --- src/c_cvars.cpp | 21 +-------------------- src/c_cvars.h | 4 ++-- src/gameconfigfile.cpp | 12 ++++++------ 3 files changed, 9 insertions(+), 28 deletions(-) diff --git a/src/c_cvars.cpp b/src/c_cvars.cpp index ba41f8259..9681f3ece 100644 --- a/src/c_cvars.cpp +++ b/src/c_cvars.cpp @@ -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) { diff --git a/src/c_cvars.h b/src/c_cvars.h index 98539be10..d7b767f33 100644 --- a/src/c_cvars.h +++ b/src/c_cvars.h @@ -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 &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); diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 156973443..56a8a2252 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -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)