1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
AlexVinS 2015-06-21 20:30:19 +03:00
parent 56a1805339
commit f81116e04d
4 changed files with 12 additions and 5 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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()