Rename SystemDialogType::ERROR to ERROR_MSG

Unfortunately, the ERROR name collides with
a preprocessor definition in windows.h
fix-squashed-planets
MrSimbax 2021-09-11 13:40:22 +02:00
parent 6aa83c93ac
commit c9dca4cebd
7 changed files with 10 additions and 14 deletions

View File

@ -662,7 +662,7 @@ bool CApplication::Create()
{
GetLogger()->Error("Unknown graphics device: %s\n", graphics.c_str());
GetLogger()->Info("Changing to default device\n");
m_systemUtils->SystemDialog(SystemDialogType::ERROR, "Graphics initialization error", "You have selected invalid graphics device with -graphics switch. Game will use default OpenGL device instead.");
m_systemUtils->SystemDialog(SystemDialogType::ERROR_MSG, "Graphics initialization error", "You have selected invalid graphics device with -graphics switch. Game will use default OpenGL device instead.");
m_device = Gfx::CreateDevice(m_deviceConfig, "opengl");
}
}

View File

@ -177,7 +177,7 @@ int main(int argc, char *argv[])
ParseArgsStatus status = app.ParseArguments(argc, argv);
if (status == PARSE_ARGS_FAIL)
{
systemUtils->SystemDialog(SystemDialogType::ERROR, "COLOBOT - Fatal Error", "Invalid commandline arguments!\n");
systemUtils->SystemDialog(SystemDialogType::ERROR_MSG, "COLOBOT - Fatal Error", "Invalid commandline arguments!\n");
return app.GetExitCode();
}
else if (status == PARSE_ARGS_HELP)
@ -190,7 +190,7 @@ int main(int argc, char *argv[])
code = app.GetExitCode();
if (code != 0 && !app.GetErrorMessage().empty())
{
systemUtils->SystemDialog(SystemDialogType::ERROR, "COLOBOT - Fatal Error", app.GetErrorMessage());
systemUtils->SystemDialog(SystemDialogType::ERROR_MSG, "COLOBOT - Fatal Error", app.GetErrorMessage());
}
logger.Info("Didn't run main loop. Exiting with code %d\n", code);
return code;

View File

@ -162,7 +162,7 @@ void CSignalHandlers::ReportError(const std::string& errorMessage)
std::cerr << std::endl << msg.str() << std::endl;
m_systemUtils->SystemDialog(SystemDialogType::ERROR, "Unhandled exception occurred!", msg.str());
m_systemUtils->SystemDialog(SystemDialogType::ERROR_MSG, "Unhandled exception occurred!", msg.str());
if (canSave && !triedSaving)
{

View File

@ -67,7 +67,7 @@ SystemDialogResult CSystemUtils::ConsoleSystemDialog(SystemDialogType type, cons
case SystemDialogType::WARNING:
std::cout << "WARNING:";
break;
case SystemDialogType::ERROR:
case SystemDialogType::ERROR_MSG:
std::cout << "ERROR: ";
break;
case SystemDialogType::YES_NO:
@ -89,7 +89,7 @@ SystemDialogResult CSystemUtils::ConsoleSystemDialog(SystemDialogType type, cons
{
case SystemDialogType::INFO:
case SystemDialogType::WARNING:
case SystemDialogType::ERROR:
case SystemDialogType::ERROR_MSG:
std::cout << "Press ENTER to continue";
break;
@ -108,7 +108,7 @@ SystemDialogResult CSystemUtils::ConsoleSystemDialog(SystemDialogType type, cons
{
case SystemDialogType::INFO:
case SystemDialogType::WARNING:
case SystemDialogType::ERROR:
case SystemDialogType::ERROR_MSG:
done = true;
break;

View File

@ -43,7 +43,7 @@ enum class SystemDialogType
//! Warning message
WARNING,
//! Error message
ERROR,
ERROR_MSG, // windows.h defines ERROR which collides with the "ERROR" enum name
//! Yes/No question
YES_NO,
//! Ok/Cancel question

View File

@ -53,7 +53,7 @@ SystemDialogResult CSystemUtilsLinux::SystemDialog(SystemDialogType type, const
case SystemDialogType::WARNING:
options = "--warning";
break;
case SystemDialogType::ERROR:
case SystemDialogType::ERROR_MSG:
options = "--error";
break;
case SystemDialogType::YES_NO:

View File

@ -44,11 +44,7 @@ SystemDialogResult CSystemUtilsWindows::SystemDialog(SystemDialogType type, cons
case SystemDialogType::WARNING:
windowsType = MB_ICONWARNING|MB_OK;
break;
// windows.h defines ERROR which collides with the enum name
#pragma push_macro("ERROR")
#undef ERROR
case SystemDialogType::ERROR:
#pragma pop_macro("ERROR")
case SystemDialogType::ERROR_MSG:
windowsType = MB_ICONERROR|MB_OK;
break;
case SystemDialogType::YES_NO: