From bdb4bdeb09fd9e1fd0e235c8053e6af4d7375e0b Mon Sep 17 00:00:00 2001 From: Alexander Kromm Date: Sat, 18 Jan 2020 00:34:11 +0700 Subject: [PATCH] save and restore config-only variables from proper sections --- src/gameconfigfile.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index de442c2c34..a04264dbef 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -579,6 +579,12 @@ void FGameConfigFile::DoGameSetup (const char *gamename) ReadCVars (0); } + strncpy (subsection, "ConfigOnlyVariables", sublen); + if (SetSection (section)) + { + ReadCVars (0); + } + strncpy (subsection, "ConsoleVariables", sublen); if (SetSection (section)) { @@ -671,6 +677,11 @@ void FGameConfigFile::DoModSetup(const char *gamename) { ReadCVars (CVAR_MOD|CVAR_SERVERINFO|CVAR_IGNORE); } + mysnprintf(section, countof(section), "%s.ConfigOnlyVariables.Mod", gamename); + if (SetSection (section)) + { + ReadCVars (CVAR_MOD|CVAR_CONFIG_ONLY|CVAR_IGNORE); + } // Signal that these sections should be rewritten when saving the config. bModSetup = true; } @@ -759,7 +770,15 @@ void FGameConfigFile::ArchiveGameData (const char *gamename) strncpy (subsection, "ConfigOnlyVariables", sublen); SetSection (section, true); ClearCurrentSection (); - C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_AUTO|CVAR_MOD|CVAR_CONFIG_ONLY); + C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_AUTO|CVAR_CONFIG_ONLY); + + if (bModSetup) + { + strncpy (subsection, "ConfigOnlyVariables.Mod", sublen); + SetSection (section, true); + ClearCurrentSection (); + C_ArchiveCVars (this, CVAR_ARCHIVE|CVAR_AUTO|CVAR_MOD|CVAR_CONFIG_ONLY); + } strncpy (subsection, "UnknownConsoleVariables", sublen); SetSection (section, true);