- consolidated I_FatalError functions

This also removes the handling from thr Posix backend and will not compile on non-Windows.
This commit is contained in:
Christoph Oelckers 2019-10-07 00:20:07 +02:00
commit b5fa08bf15
7 changed files with 66 additions and 177 deletions

View file

@ -2290,6 +2290,42 @@ void I_Error(const char *error, ...)
throw CRecoverableError(errortext);
}
//==========================================================================
//
// I_FatalError
//
// Throw an error that will end the game.
//
//==========================================================================
extern FILE *Logfile;
void I_FatalError(const char *error, ...)
{
static bool alreadyThrown = false;
gameisdead = true;
if (!alreadyThrown) // ignore all but the first message -- killough
{
alreadyThrown = true;
char errortext[MAX_ERRORTEXT];
va_list argptr;
va_start(argptr, error);
myvsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
I_DebugPrint(errortext);
// Record error to log (if logging)
if (Logfile)
{
fprintf(Logfile, "\n**** DIED WITH FATAL ERROR:\n%s\n", errortext);
fflush(Logfile);
}
throw CFatalError(errortext);
}
std::terminate(); // recursive I_FatalErrors must immediately terminate.
}
//==========================================================================
//
// I_Quit