- refactored the exit calls out of the networking code

These ones were particularly bad examples of misusing the exit handlers by temporarily installing one themselves and then calling exit to clean stuff up.

Now they just return an error code to D_DoomMain to perform a regular exit.
This commit is contained in:
Christoph Oelckers 2019-10-07 00:55:14 +02:00
commit 0a611e1992
4 changed files with 35 additions and 28 deletions

View file

@ -127,7 +127,7 @@ const FIWADInfo *D_FindIWAD(TArray<FString> &wadfiles, const char *iwad, const c
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
void D_CheckNetGame ();
bool D_CheckNetGame ();
void D_ProcessEvents ();
void G_BuildTiccmd (ticcmd_t* cmd);
void D_DoAdvanceDemo ();
@ -2353,7 +2353,7 @@ void I_Quit()
//
//==========================================================================
static void D_DoomMain_Internal (void)
static int D_DoomMain_Internal (void)
{
int p;
const char *v;
@ -2710,7 +2710,10 @@ static void D_DoomMain_Internal (void)
{
if (!batchrun) Printf ("D_CheckNetGame: Checking network game status.\n");
StartScreen->LoadingStatus ("Checking network game status.", 0x3f);
D_CheckNetGame ();
if (!D_CheckNetGame ())
{
return 0;
}
}
// [SP] Force vanilla transparency auto-detection to re-detect our game lumps now
@ -2746,7 +2749,7 @@ static void D_DoomMain_Internal (void)
if (Args->CheckParm("-norun") || batchrun)
{
return;
return 1337; // special exit
}
V_Init2();
@ -2842,8 +2845,7 @@ int D_DoomMain()
int ret = 0;
try
{
D_DoomMain_Internal();
ret = 1337;
ret = D_DoomMain_Internal();
}
catch (std::exception &error)
{