save and restore config-only variables from proper sections

This commit is contained in:
Alexander Kromm 2020-01-18 00:34:11 +07:00 committed by Christoph Oelckers
parent 039196bcb3
commit bdb4bdeb09
1 changed files with 20 additions and 1 deletions

View File

@ -579,6 +579,12 @@ void FGameConfigFile::DoGameSetup (const char *gamename)
ReadCVars (0); ReadCVars (0);
} }
strncpy (subsection, "ConfigOnlyVariables", sublen);
if (SetSection (section))
{
ReadCVars (0);
}
strncpy (subsection, "ConsoleVariables", sublen); strncpy (subsection, "ConsoleVariables", sublen);
if (SetSection (section)) if (SetSection (section))
{ {
@ -671,6 +677,11 @@ void FGameConfigFile::DoModSetup(const char *gamename)
{ {
ReadCVars (CVAR_MOD|CVAR_SERVERINFO|CVAR_IGNORE); 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. // Signal that these sections should be rewritten when saving the config.
bModSetup = true; bModSetup = true;
} }
@ -759,7 +770,15 @@ void FGameConfigFile::ArchiveGameData (const char *gamename)
strncpy (subsection, "ConfigOnlyVariables", sublen); strncpy (subsection, "ConfigOnlyVariables", sublen);
SetSection (section, true); SetSection (section, true);
ClearCurrentSection (); 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); strncpy (subsection, "UnknownConsoleVariables", sublen);
SetSection (section, true); SetSection (section, true);