mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Use exception throwing to shutdown main thread
This commit is contained in:
@@ -100,13 +100,15 @@ bool GameInstance::capturedAllEvents()
|
||||
|
||||
void GameInstance::onShutdownRequested(bool ask)
|
||||
{
|
||||
auto doQuit = [](){ throw GameShutdownException(); };
|
||||
|
||||
if(!ask)
|
||||
quitApplication();
|
||||
doQuit();
|
||||
else
|
||||
{
|
||||
if (interface())
|
||||
interface()->showYesNoDialog(LIBRARY->generaltexth->allTexts[69], quitApplication, nullptr);
|
||||
interface()->showYesNoDialog(LIBRARY->generaltexth->allTexts[69], doQuit, nullptr);
|
||||
else
|
||||
CInfoWindow::showYesNoDialog(LIBRARY->generaltexth->allTexts[69], {}, quitApplication, {}, PlayerColor(1));
|
||||
CInfoWindow::showYesNoDialog(LIBRARY->generaltexth->allTexts[69], {}, doQuit, {}, PlayerColor(1));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user