Skip to content

Commit

Permalink
- consolidated the 3 I_Error implementations
Browse files Browse the repository at this point in the history
Debug output is now being handled by the respective interface functions, not by the Windows I_Error itself.
  • Loading branch information
coelckers committed Oct 6, 2019
1 parent d7289f6 commit cd086ae
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 52 deletions.
28 changes: 28 additions & 0 deletions src/d_main.cpp
Expand Up @@ -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)
Expand Down
13 changes: 0 additions & 13 deletions src/posix/cocoa/i_system.mm
Expand Up @@ -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()
{
}
Expand Down
12 changes: 0 additions & 12 deletions src/posix/sdl/i_system.cpp
Expand Up @@ -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 ()
{
}
Expand Down
32 changes: 5 additions & 27 deletions src/win32/i_system.cpp
Expand Up @@ -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);
}

//==========================================================================
//
Expand Down Expand Up @@ -560,8 +535,11 @@ static TArray<FString> 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)
Expand Down

0 comments on commit cd086ae

Please sign in to comment.