AlexVinS 10 ani în urmă
părinte
comite
f81116e04d
4 a modificat fișierele cu 12 adăugiri și 5 ștergeri
  1. 8 2
      client/CMT.cpp
  2. 1 1
      client/CMT.h
  3. 2 1
      client/CPlayerInterface.h
  4. 1 1
      client/windows/GUIClasses.cpp

+ 8 - 2
client/CMT.cpp

@@ -1127,6 +1127,12 @@ static void handleEvent(SDL_Event & ev)
 	{
 		switch(ev.user.code)
 		{
+		case FORCE_QUIT:
+			{
+				handleQuit(false);	
+				return;			
+			}
+		    break;
 		case RETURN_TO_MAIN_MENU:
 			{
 				endGame();
@@ -1244,7 +1250,7 @@ void endGame()
 	vstd::clear_pointer(client);
 }
 
-void handleQuit()
+void handleQuit(bool ask/* = true*/)
 {
 	auto quitApplication = []()
 	{
@@ -1261,7 +1267,7 @@ void handleQuit()
 		exit(0);
 	};
 
-	if(client && LOCPLINT)
+	if(client && LOCPLINT && ask)
 	{
 		CCS->curh->changeGraphic(ECursor::ADVENTURE, 0);
 		LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[69], quitApplication, 0);

+ 1 - 1
client/CMT.h

@@ -17,4 +17,4 @@ extern SDL_Surface *screenBuf; // points to screen (if only advmapint is present
 
 extern bool gNoGUI; //if true there is no client window and game is silently played between AIs
 
-void handleQuit();
+void handleQuit(bool ask = true);

+ 2 - 1
client/CPlayerInterface.h

@@ -80,7 +80,8 @@ enum
 	RESTART_GAME,
 	RETURN_TO_MENU_LOAD,
 	FULLSCREEN_TOGGLED,
-	PREPARE_RESTART_CAMPAIGN
+	PREPARE_RESTART_CAMPAIGN,
+	FORCE_QUIT //quit client without question
 };
 
 /// Central class for managing user interface logic

+ 1 - 1
client/windows/GUIClasses.cpp

@@ -656,7 +656,7 @@ void CSystemOptionsWindow::setGameRes(int index)
 
 void CSystemOptionsWindow::bquitf()
 {
-	LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[578], [this]{ closeAndPushEvent(SDL_QUIT); }, 0);
+	LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[578], [this]{ closeAndPushEvent(SDL_USEREVENT, FORCE_QUIT); }, 0);
 }
 
 void CSystemOptionsWindow::breturnf()