- Added a dialog that gives the user the chance to fix things if the config
could not be saved for some reason. - Added the writeini console command to write the config file, optionally specifying a specific file name for it. - Fixed: "Multiplayer" demos that only had one player were not played back properly because the demo playback code only checked the number of players to determine if it should be played as a netdemo. SVN r333 (trunk)
This commit is contained in:
parent
8854f95152
commit
b132575533
12 changed files with 98 additions and 8 deletions
|
|
@ -339,18 +339,51 @@ FString GetUserFile (const char *file, bool nodir)
|
|||
// M_SaveDefaults
|
||||
//
|
||||
|
||||
void M_SaveDefaults ()
|
||||
bool M_SaveDefaults (const char *filename)
|
||||
{
|
||||
FString oldpath;
|
||||
bool success;
|
||||
|
||||
if (filename != NULL)
|
||||
{
|
||||
oldpath = GameConfig->GetPathName();
|
||||
GameConfig->ChangePathName (filename);
|
||||
}
|
||||
GameConfig->ArchiveGlobalData ();
|
||||
if (GameNames[gameinfo.gametype] != NULL)
|
||||
{
|
||||
GameConfig->ArchiveGameData (GameNames[gameinfo.gametype]);
|
||||
}
|
||||
GameConfig->WriteConfigFile ();
|
||||
success = GameConfig->WriteConfigFile ();
|
||||
if (filename != NULL)
|
||||
{
|
||||
GameConfig->ChangePathName (filename);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
void M_SaveDefaultsFinal ()
|
||||
{
|
||||
while (!M_SaveDefaults (NULL) && I_WriteIniFailed ())
|
||||
{
|
||||
/* Loop until the config saves or I_WriteIniFailed() returns false */
|
||||
}
|
||||
delete GameConfig;
|
||||
GameConfig = NULL;
|
||||
}
|
||||
|
||||
CCMD (writeini)
|
||||
{
|
||||
const char *filename = (argv.argc() == 1) ? NULL : argv[1];
|
||||
if (!M_SaveDefaults (filename))
|
||||
{
|
||||
Printf ("Writing config failed: %s\n", strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf ("Config saved.\n");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// M_LoadDefaults
|
||||
|
|
@ -361,7 +394,7 @@ void M_LoadDefaults ()
|
|||
GameConfig = new FGameConfigFile;
|
||||
GameConfig->DoGlobalSetup ();
|
||||
atterm (FreeKeySections);
|
||||
atterm (M_SaveDefaults);
|
||||
atterm (M_SaveDefaultsFinal);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue