mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-25 13:55:36 -04:00
Pop up a GUI dialog box to show the error message in I_Error()
Shamelessly taken from Chocolate Doom, again.
This commit is contained in:
parent
f4acd9d6bd
commit
f97f622c99
@ -271,9 +271,20 @@ void I_Quit (void)
|
||||
//
|
||||
// I_Error
|
||||
//
|
||||
static boolean I_ConsoleStdout(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// SDL "helpfully" always redirects stdout to a file.
|
||||
return false;
|
||||
#else
|
||||
return isatty(fileno(stdout));
|
||||
#endif
|
||||
}
|
||||
|
||||
void I_Error(const char *error, ...) // killough 3/20/98: add const
|
||||
{
|
||||
boolean exit_gui_popup;
|
||||
|
||||
if(!*errmsg) // ignore all but the first message -- killough
|
||||
{
|
||||
va_list argptr;
|
||||
@ -282,6 +293,19 @@ void I_Error(const char *error, ...) // killough 3/20/98: add const
|
||||
va_end(argptr);
|
||||
}
|
||||
|
||||
// If specified, don't show a GUI window for error messages when the
|
||||
// game exits with an error.
|
||||
exit_gui_popup = !M_CheckParm("-nogui");
|
||||
|
||||
// Pop up a GUI dialog box to show the error message, if the
|
||||
// game was not run from the console (and the user will
|
||||
// therefore be unable to otherwise see the message).
|
||||
if (exit_gui_popup && !I_ConsoleStdout())
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
||||
PACKAGE_STRING, errmsg, NULL);
|
||||
}
|
||||
|
||||
if(!has_exited) // If it hasn't exited yet, exit now -- killough
|
||||
{
|
||||
has_exited=1; // Prevent infinitely recursive exits -- killough
|
||||
|
Loading…
x
Reference in New Issue
Block a user