Display pop-up message when fatal error occured on windows.

The reason to do it is that in release mode we don't receive any message in console. This causes that the game sometimes doesn't start and you have no idea why (for example missing supertuxkart.git file etc.).
This commit is contained in:
deve 2015-12-14 12:25:04 +01:00
parent 4531b15d5c
commit 5f46863a19

View File

@ -197,7 +197,7 @@ void Log::printMessage(int level, const char *component, const char *format,
OutputDebugString(szBuff);
OutputDebugString("\r\n");
#endif
if(m_file_stdout)
{
@ -207,6 +207,25 @@ void Log::printMessage(int level, const char *component, const char *format,
va_end(copy);
}
#ifdef WIN32
if (level >= LL_FATAL)
{
std::string message;
char tmp[2048];
sprintf(tmp, "[%s] %s: ", names[level], component);
message += tmp;
VALIST out;
va_copy(out, args);
vsprintf(tmp, format, out);
message += tmp;
va_end(out);
MessageBoxA(NULL, message.c_str(), "SuperTuxKart - Fatal error", MB_OK);
}
#endif
#endif
} // printMessage