- allow renaming of config sections and added migration code to rename the old autoload sections to the more flexible naming system that's planned.

This commit is contained in:
Christoph Oelckers 2015-04-06 11:21:28 +02:00
parent cac634567b
commit 3114a26bc8
4 changed files with 38 additions and 1 deletions

View File

@ -513,6 +513,22 @@ FConfigFile::FConfigSection *FConfigFile::FindSection (const char *name) const
return section;
}
//====================================================================
//
// FConfigFile :: RenameSection
//
//====================================================================
void FConfigFile::RenameSection (const char *oldname, const char *newname) const
{
FConfigSection *section = FindSection(oldname);
if (section != NULL)
{
section->SectionName = newname;
}
}
//====================================================================
//
// FConfigFile :: FindEntry

View File

@ -78,6 +78,7 @@ protected:
virtual char *ReadLine (char *string, int n, void *file) const;
bool ReadConfig (void *file);
static const char *GenerateEndTag(const char *value);
void RenameSection(const char *oldname, const char *newname) const;
bool OkayToWrite;
bool FileExisted;

View File

@ -334,6 +334,26 @@ void FGameConfigFile::DoGlobalSetup ()
SetValueForKey ("5", "use ArtiInvulnerability2");
}
}
if (last < 211)
{
//RenameSection("Hacx2.Autoload", "hacx.2_0.Autoload");
//RenameSection("Hacx12.Autoload", "hacx.1_2.Autoload");
//RenameSection("Hexen1.Autoload", "hexen.hexen.Autoload");
RenameSection("Chex3.Autoload", "chex.3.Autoload");
RenameSection("Chex1.Autoload", "chex.1.Autoload");
RenameSection("HexenDK.Autoload", "hexen.deathkings.Autoload");
RenameSection("HereticSR.Autoload", "heretic.shadow.Autoload");
RenameSection("FreeDM.Autoload", "doom.freedoom.freedm.Autoload");
RenameSection("Freedoom2.Autoload", "doom.freedoom.phase2.Autoload");
RenameSection("Freedoom1.Autoload", "doom.freedoom.phase1.Autoload");
RenameSection("DoomBFG.Autoload", "doom.doom1.bfg.Autoload");
RenameSection("DoomU.Autoload", "doom.doom1.ultimate.Autoload");
RenameSection("Doom1.Autoload", "doom.doom1.registered.Autoload");
RenameSection("TNT.Autoload", "doom.doom2.tnt.Autoload");
RenameSection("Plutonia.Autoload", "doom.doom2.plutonia.Autoload");
RenameSection("Doom2BFG.Autoload", "doom.doom2.bfg.Autoload");
RenameSection("Doom2.Autoload", "doom.doom2.commercial.Autoload");
}
}
}
}

View File

@ -56,7 +56,7 @@ const char *GetVersionString();
// Version stored in the ini's [LastRun] section.
// Bump it if you made some configuration change that you want to
// be able to migrate in FGameConfigFile::DoGlobalSetup().
#define LASTRUNVERSION "210"
#define LASTRUNVERSION "211"
// Protocol version used in demos.
// Bump it if you change existing DEM_ commands or add new ones.