|
@@ -169,40 +169,44 @@ void CPlayerInterface::initGameInterface(std::shared_ptr<Environment> ENV, std::
|
|
|
adventureInt.reset(new AdventureMapInterface());
|
|
|
}
|
|
|
|
|
|
-void CPlayerInterface::playerEndsTurn(PlayerColor player)
|
|
|
+void CPlayerInterface::closeAllDialogs()
|
|
|
{
|
|
|
- EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- if (player == playerID)
|
|
|
+ // remove all active dialogs that do not expect query answer
|
|
|
+ for (;;)
|
|
|
{
|
|
|
- makingTurn = false;
|
|
|
+ auto adventureWindow = GH.windows().topWindow<AdventureMapInterface>();
|
|
|
+ auto infoWindow = GH.windows().topWindow<CInfoWindow>();
|
|
|
|
|
|
- // remove all active dialogs that do not expect query answer
|
|
|
- for (;;)
|
|
|
- {
|
|
|
- auto adventureWindow = GH.windows().topWindow<AdventureMapInterface>();
|
|
|
- auto infoWindow = GH.windows().topWindow<CInfoWindow>();
|
|
|
+ if(adventureWindow != nullptr)
|
|
|
+ break;
|
|
|
|
|
|
- if(adventureWindow != nullptr)
|
|
|
- break;
|
|
|
+ if(infoWindow && infoWindow->ID != QueryID::NONE)
|
|
|
+ break;
|
|
|
|
|
|
- if(infoWindow && infoWindow->ID != QueryID::NONE)
|
|
|
- break;
|
|
|
+ if (infoWindow)
|
|
|
+ infoWindow->close();
|
|
|
+ else
|
|
|
+ GH.windows().popWindows(1);
|
|
|
+ }
|
|
|
|
|
|
- if (infoWindow)
|
|
|
- infoWindow->close();
|
|
|
- else
|
|
|
- GH.windows().popWindows(1);
|
|
|
- }
|
|
|
+ if(castleInt)
|
|
|
+ castleInt->close();
|
|
|
|
|
|
- if(castleInt)
|
|
|
- castleInt->close();
|
|
|
+ castleInt = nullptr;
|
|
|
|
|
|
- castleInt = nullptr;
|
|
|
+ // remove all pending dialogs that do not expect query answer
|
|
|
+ vstd::erase_if(dialogs, [](const std::shared_ptr<CInfoWindow> & window){
|
|
|
+ return window->ID == QueryID::NONE;
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
- // remove all pending dialogs that do not expect query answer
|
|
|
- vstd::erase_if(dialogs, [](const std::shared_ptr<CInfoWindow> & window){
|
|
|
- return window->ID == QueryID::NONE;
|
|
|
- });
|
|
|
+void CPlayerInterface::playerEndsTurn(PlayerColor player)
|
|
|
+{
|
|
|
+ EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
+ if (player == playerID)
|
|
|
+ {
|
|
|
+ makingTurn = false;
|
|
|
+ closeAllDialogs();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -284,6 +288,7 @@ void CPlayerInterface::gamePause(bool pause)
|
|
|
|
|
|
void CPlayerInterface::yourTurn(QueryID queryID)
|
|
|
{
|
|
|
+ closeAllDialogs();
|
|
|
CTutorialWindow::openWindowFirstTime(TutorialMode::TOUCH_ADVENTUREMAP);
|
|
|
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|