mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Correctly close dialogs on end of turn
This commit is contained in:
parent
54adeef29f
commit
49c148502b
@ -183,7 +183,32 @@ void CPlayerInterface::playerEndsTurn(PlayerColor player)
|
||||
{
|
||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||
if (player == playerID)
|
||||
{
|
||||
makingTurn = false;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
// 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::playerStartsTurn(PlayerColor player)
|
||||
@ -250,21 +275,6 @@ void CPlayerInterface::yourTurn(QueryID queryID)
|
||||
LOCPLINT = this;
|
||||
GH.curInt = this;
|
||||
|
||||
// close window from another player
|
||||
if(auto w = GH.windows().topWindow<CInfoWindow>())
|
||||
{
|
||||
assert(0);// what is this?
|
||||
if(w->ID == QueryID::NONE)
|
||||
w->close();
|
||||
}
|
||||
|
||||
// remove all dialogs that do not expect query answer
|
||||
while (!GH.windows().topWindow<AdventureMapInterface>() && !GH.windows().topWindow<CInfoWindow>())
|
||||
{
|
||||
assert(0);// what is this?
|
||||
GH.windows().popWindows(1);
|
||||
}
|
||||
|
||||
NotificationHandler::notify("Your turn");
|
||||
if(settings["general"]["startTurnAutosave"].Bool())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user