diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 7cb2686c..551f2364 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -548,7 +548,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) { mainProgram->showMessage(msg.c_str()); } - message(msg.c_str()); + message(msg.c_str(),GlobalStaticFlags::getIsNonGraphicalModeEnabled()); } #endif @@ -564,7 +564,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) { mainProgram->showMessage(msg.c_str()); } - message(msg.c_str()); + message(msg.c_str(),GlobalStaticFlags::getIsNonGraphicalModeEnabled()); } void ExceptionHandler::logError(const char *msg, bool confirmToConsole) { @@ -733,7 +733,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) { #endif if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); - message(err); + message(err,GlobalStaticFlags::getIsNonGraphicalModeEnabled()); } if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); @@ -789,7 +789,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) { } else { if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] msg [%s] exitApp = %d\n",__FILE__,__FUNCTION__,__LINE__,msg,exitApp); - message(msg); + message(msg,GlobalStaticFlags::getIsNonGraphicalModeEnabled()); } if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] msg [%s] exitApp = %d\n",__FILE__,__FUNCTION__,__LINE__,msg,exitApp); @@ -5434,7 +5434,7 @@ int glestMain(int argc, char** argv) { if(program != NULL && program->getTryingRendererInit() == true && program->getRendererInitOk() == false) { - message(e.what()); + message(e.what(),GlobalStaticFlags::getIsNonGraphicalModeEnabled()); } } @@ -5586,7 +5586,7 @@ static bool MinidumpCallback(const google_breakpad::MinidumpDescriptor& descript char szBuf[8096]; snprintf(szBuf,8096,"An unhandled error was detected.\n\nA crash dump file has been created in the folder:\n%s\nCrash dump filename is: %s",descriptor.directory().c_str(),descriptor.path()); //MessageBox(NULL, szBuf, "Unhandled error", MB_OK|MB_SYSTEMMODAL); - message(szBuf); + message(szBuf,GlobalStaticFlags::getIsNonGraphicalModeEnabled()); } return succeeded; diff --git a/source/shared_lib/include/platform/sdl/platform_util.h b/source/shared_lib/include/platform/sdl/platform_util.h index 14744750..719e86dd 100644 --- a/source/shared_lib/include/platform/sdl/platform_util.h +++ b/source/shared_lib/include/platform/sdl/platform_util.h @@ -59,8 +59,7 @@ public: // ===================================================== // Misc // ===================================================== -void message(string message); -bool ask(string message); +void message(string message,bool isNonGraphicalModeEnabled); void exceptionMessage(const exception &excp); string getCommandLine(); diff --git a/source/shared_lib/sources/platform/sdl/platform_util.cpp b/source/shared_lib/sources/platform/sdl/platform_util.cpp index d3757c89..742c0fd6 100644 --- a/source/shared_lib/sources/platform/sdl/platform_util.cpp +++ b/source/shared_lib/sources/platform/sdl/platform_util.cpp @@ -78,24 +78,17 @@ bool showMessage(const std::string & warning) { return guiMessage; } -void message(string message) { - showMessage(message); - +void message(string message, bool isNonGraphicalModeEnabled) { std::cerr << "******************************************************\n"; std::cerr << " " << message << "\n"; std::cerr << "******************************************************\n"; -} -bool ask(string message) { - std::cerr << "Confirmation: " << message << "\n"; - int res; - std::cin >> res; - return res != 0; + if(isNonGraphicalModeEnabled == false) { + showMessage(message); + } } void exceptionMessage(const exception &excp) { - //showMessage(excp.what()); - std::cerr << "Exception: " << excp.what() << std::endl; } diff --git a/source/shared_lib/sources/platform/win32/platform_util.cpp b/source/shared_lib/sources/platform/win32/platform_util.cpp index c63001ab..542d4338 100644 --- a/source/shared_lib/sources/platform/win32/platform_util.cpp +++ b/source/shared_lib/sources/platform/win32/platform_util.cpp @@ -325,21 +325,16 @@ megaglest_runtime_error::megaglest_runtime_error(const string& __arg,bool noStac // assert(dispChangeErr==DISP_CHANGE_SUCCESSFUL); //} -void message(string message){ +void message(string message, bool isNonGraphicalModeEnabled) { std::cerr << "******************************************************\n"; std::cerr << " " << message << "\n"; std::cerr << "******************************************************\n"; - LPWSTR wstr = Ansi2WideString(message.c_str()); - MessageBox(NULL, wstr, L"Message", MB_OK | MB_SYSTEMMODAL); - if(wstr) delete [] wstr; -} - -bool ask(string message){ - LPWSTR wstr = Ansi2WideString(message.c_str()); - bool result = MessageBox(NULL, wstr, L"Confirmation", MB_YESNO | MB_SYSTEMMODAL) == IDYES; - if(wstr) delete [] wstr; - return result; + if(isNonGraphicalModeEnabled == false) { + LPWSTR wstr = Ansi2WideString(message.c_str()); + MessageBox(NULL, wstr, L"Message", MB_OK | MB_SYSTEMMODAL); + if(wstr) delete [] wstr; + } } void exceptionMessage(const exception &excp){