diff --git a/src/d_main.cpp b/src/d_main.cpp index 47a04a4a0..1ad32b952 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2268,6 +2268,34 @@ static void CheckCmdLine() } } +//========================================================================== +// +// I_Error +// +// Throw an error that will send us to the console if we are far enough +// along in the startup process. +// +//========================================================================== + +void I_Error(const char *error, ...) +{ + va_list argptr; + char errortext[MAX_ERRORTEXT]; + + va_start(argptr, error); + myvsnprintf(errortext, MAX_ERRORTEXT, error, argptr); + va_end(argptr); + I_DebugPrint(errortext); + + throw CRecoverableError(errortext); +} + +//========================================================================== +// +// I_Quit +// +//========================================================================== + void I_Quit() { if (demorecording) diff --git a/src/posix/cocoa/i_system.mm b/src/posix/cocoa/i_system.mm index b05d7dc82..62e4ef5e3 100644 --- a/src/posix/cocoa/i_system.mm +++ b/src/posix/cocoa/i_system.mm @@ -132,19 +132,6 @@ void I_FatalError(const char* const error, ...) } -void I_Error (const char *error, ...) -{ - va_list argptr; - char errortext[MAX_ERRORTEXT]; - - va_start(argptr, error); - - myvsnprintf (errortext, MAX_ERRORTEXT, error, argptr); - va_end (argptr); - throw CRecoverableError(errortext); -} - - void I_SetIWADInfo() { } diff --git a/src/posix/sdl/i_system.cpp b/src/posix/sdl/i_system.cpp index a9d563763..f2b885f90 100644 --- a/src/posix/sdl/i_system.cpp +++ b/src/posix/sdl/i_system.cpp @@ -182,18 +182,6 @@ void I_FatalError(const char* const error, ...) } -void I_Error (const char *error, ...) -{ - va_list argptr; - char errortext[MAX_ERRORTEXT]; - - va_start(argptr, error); - - myvsnprintf (errortext, MAX_ERRORTEXT, error, argptr); - va_end (argptr); - throw CRecoverableError(errortext); -} - void I_SetIWADInfo () { } diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index ea60b07ae..d891e90b0 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -374,31 +374,6 @@ void I_FatalError(const char *error, ...) std::terminate(); } -//========================================================================== -// -// I_Error -// -// Throw an error that will send us to the console if we are far enough -// along in the startup process. -// -//========================================================================== - -void I_Error(const char *error, ...) -{ - va_list argptr; - char errortext[MAX_ERRORTEXT]; - - va_start(argptr, error); - myvsnprintf(errortext, MAX_ERRORTEXT, error, argptr); - va_end(argptr); - if (IsDebuggerPresent()) - { - auto wstr = WideString(errortext); - OutputDebugStringW(wstr.c_str()); - } - - throw CRecoverableError(errortext); -} //========================================================================== // @@ -560,8 +535,11 @@ static TArray bufferedConsoleStuff; void I_DebugPrint(const char *cp) { - auto wstr = WideString(cp); - OutputDebugStringW(wstr.c_str()); + if (IsDebuggerPresent()) + { + auto wstr = WideString(cp); + OutputDebugStringW(wstr.c_str()); + } } void I_PrintStr(const char *cp)