summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/i_system.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/i_system.c b/src/i_system.c
index 5aa57348..4e076d9d 100644
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -356,6 +356,7 @@ static boolean already_quitting = false;
void I_Error (char *error, ...)
{
+ char msgbuf[512];
va_list argptr;
atexit_listentry_t *entry;
boolean exit_gui_popup;
@@ -369,7 +370,7 @@ void I_Error (char *error, ...)
{
already_quitting = true;
}
-
+
// Message first.
va_start(argptr, error);
//fprintf(stderr, "\nError: ");
@@ -378,6 +379,12 @@ void I_Error (char *error, ...)
va_end(argptr);
fflush(stderr);
+ // Write a copy of the message into buffer.
+ va_start(argptr, error);
+ memset(msgbuf, 0, sizeof(msgbuf));
+ M_vsnprintf(msgbuf, sizeof(msgbuf), error, argptr);
+ va_end(argptr);
+
// Shutdown. Here might be other errors.
entry = exit_funcs;
@@ -394,19 +401,14 @@ void I_Error (char *error, ...)
exit_gui_popup = !M_ParmExists("-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())
#ifdef _WIN32
- // On Windows, pop up a dialog box with the error message.
-
- if (exit_gui_popup)
{
- char msgbuf[512];
wchar_t wmsgbuf[512];
- va_start(argptr, error);
- memset(msgbuf, 0, sizeof(msgbuf));
- M_vsnprintf(msgbuf, sizeof(msgbuf), error, argptr);
- va_end(argptr);
-
MultiByteToWideChar(CP_ACP, 0,
msgbuf, strlen(msgbuf) + 1,
wmsgbuf, sizeof(wmsgbuf));
@@ -414,17 +416,10 @@ void I_Error (char *error, ...)
MessageBoxW(NULL, wmsgbuf, L"", MB_OK);
}
#elif defined(__MACOSX__)
- if (exit_gui_popup && !I_ConsoleStdout())
{
CFStringRef message;
- char msgbuf[512];
int i;
- va_start(argptr, error);
- memset(msgbuf, 0, sizeof(msgbuf));
- M_vsnprintf(msgbuf, sizeof(msgbuf), error, argptr);
- va_end(argptr);
-
// The CoreFoundation message box wraps text lines, so replace
// newline characters with spaces so that multiline messages
// are continuous.
@@ -450,9 +445,8 @@ void I_Error (char *error, ...)
NULL);
}
#else
- if (exit_gui_popup && !I_ConsoleStdout())
{
- ZenityErrorBox(error);
+ ZenityErrorBox(msgbuf);
}
#endif