- the big cleanup of the exit cleanup is done!

atterm is gone and only a few system-side functions use atexit.
All game side cleanup is performed in D_DoomMain now.
This commit is contained in:
Christoph Oelckers 2019-10-07 20:28:55 +02:00
commit 2e7af1338c
37 changed files with 82 additions and 344 deletions

View file

@ -66,7 +66,6 @@
#include "gameconfigfile.h"
#include "gstrings.h"
#include "atterm.h"
FGameConfigFile *GameConfig;
@ -271,7 +270,8 @@ bool M_SaveDefaults (const char *filename)
FString oldpath;
bool success;
if (filename != NULL)
if (GameConfig == nullptr) return true;
if (filename != nullptr)
{
oldpath = GameConfig->GetPathName();
GameConfig->ChangePathName (filename);
@ -282,7 +282,7 @@ bool M_SaveDefaults (const char *filename)
GameConfig->ArchiveGameData (gameinfo.ConfigName);
}
success = GameConfig->WriteConfigFile ();
if (filename != NULL)
if (filename != nullptr)
{
GameConfig->ChangePathName (filename);
}
@ -291,12 +291,13 @@ bool M_SaveDefaults (const char *filename)
void M_SaveDefaultsFinal ()
{
while (!M_SaveDefaults (NULL) && I_WriteIniFailed ())
if (GameConfig == nullptr) return;
while (!M_SaveDefaults (nullptr) && I_WriteIniFailed ())
{
/* Loop until the config saves or I_WriteIniFailed() returns false */
}
delete GameConfig;
GameConfig = NULL;
GameConfig = nullptr;
}
UNSAFE_CCMD (writeini)
@ -320,7 +321,6 @@ void M_LoadDefaults ()
{
GameConfig = new FGameConfigFile;
GameConfig->DoGlobalSetup ();
atterm(M_SaveDefaultsFinal);
}