mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-23 12:08:45 +02:00
Close all dialogs on start of new turn in MP
This commit is contained in:
parent
434a2fb0fb
commit
5f0e6f7ce1
@ -169,40 +169,44 @@ void CPlayerInterface::initGameInterface(std::shared_ptr<Environment> ENV, std::
|
|||||||
adventureInt.reset(new AdventureMapInterface());
|
adventureInt.reset(new AdventureMapInterface());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPlayerInterface::closeAllDialogs()
|
||||||
|
{
|
||||||
|
// 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(infoWindow && infoWindow->ID != QueryID::NONE)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (infoWindow)
|
||||||
|
infoWindow->close();
|
||||||
|
else
|
||||||
|
GH.windows().popWindows(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(castleInt)
|
||||||
|
castleInt->close();
|
||||||
|
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void CPlayerInterface::playerEndsTurn(PlayerColor player)
|
void CPlayerInterface::playerEndsTurn(PlayerColor player)
|
||||||
{
|
{
|
||||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||||
if (player == playerID)
|
if (player == playerID)
|
||||||
{
|
{
|
||||||
makingTurn = false;
|
makingTurn = false;
|
||||||
|
closeAllDialogs();
|
||||||
// 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(infoWindow && infoWindow->ID != QueryID::NONE)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (infoWindow)
|
|
||||||
infoWindow->close();
|
|
||||||
else
|
|
||||||
GH.windows().popWindows(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(castleInt)
|
|
||||||
castleInt->close();
|
|
||||||
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +288,7 @@ void CPlayerInterface::gamePause(bool pause)
|
|||||||
|
|
||||||
void CPlayerInterface::yourTurn(QueryID queryID)
|
void CPlayerInterface::yourTurn(QueryID queryID)
|
||||||
{
|
{
|
||||||
|
closeAllDialogs();
|
||||||
CTutorialWindow::openWindowFirstTime(TutorialMode::TOUCH_ADVENTUREMAP);
|
CTutorialWindow::openWindowFirstTime(TutorialMode::TOUCH_ADVENTUREMAP);
|
||||||
|
|
||||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||||
|
@ -203,6 +203,7 @@ public: // public interface for use by client via LOCPLINT access
|
|||||||
void performAutosave();
|
void performAutosave();
|
||||||
void gamePause(bool pause);
|
void gamePause(bool pause);
|
||||||
void endNetwork();
|
void endNetwork();
|
||||||
|
void closeAllDialogs();
|
||||||
|
|
||||||
///returns true if all events are processed internally
|
///returns true if all events are processed internally
|
||||||
bool capturedAllEvents();
|
bool capturedAllEvents();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user