- move section renaming code into FGameConfigFile's constructor so renaming of the old and creation of the new autoload sections can be done in one step, not two.

This commit is contained in:
Christoph Oelckers 2015-04-07 08:46:42 +02:00
parent cf7c04b605
commit e75bdf86db

View file

@ -172,10 +172,24 @@ FGameConfigFile::FGameConfigFile (FIWadManager *iwad_man)
if (lastver != NULL) last = atof(lastver);
}
// don't create the autoload section if we are about to migrate an old config because it'd mess up the upcoming migration step.
// This will be taken care of once the game runs again with the migrated config file.
if (last >= 211)
if (last < 211)
{
RenameSection("Chex3.Autoload", "chex.chex3.Autoload");
RenameSection("Chex1.Autoload", "chex.chex1.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("Freedoom.Autoload", "doom.freedoom.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");
}
const FString *pAuto;
for (int num = 0; (pAuto = iwad_man->GetAutoname(num)) != NULL; num++)
{
@ -193,7 +207,6 @@ FGameConfigFile::FGameConfigFile (FIWadManager *iwad_man)
}
}
}
}
CreateSectionAtStart("Global.Autoload");
// The same goes for auto-exec files.
@ -343,24 +356,6 @@ void FGameConfigFile::DoGlobalSetup ()
SetValueForKey ("5", "use ArtiInvulnerability2");
}
}
if (last < 211)
{
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("Freedoom.Autoload", "doom.freedoom.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");
}
}
}
}