1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Merge pull request #4581 from dydzio0614/multiplayer-interface-freeze

Multiplayer freeze fix
This commit is contained in:
Ivan Savenko
2024-09-12 14:14:47 +03:00
committed by GitHub
3 changed files with 4 additions and 12 deletions

View File

@@ -172,10 +172,11 @@ void CPlayerInterface::initGameInterface(std::shared_ptr<Environment> ENV, std::
void CPlayerInterface::closeAllDialogs()
{
// remove all active dialogs that do not expect query answer
for (;;)
while(true)
{
auto adventureWindow = GH.windows().topWindow<AdventureMapInterface>();
auto infoWindow = GH.windows().topWindow<CInfoWindow>();
auto topWindow = GH.windows().topWindow<WindowBase>();
if(adventureWindow != nullptr)
break;
@@ -183,16 +184,8 @@ void CPlayerInterface::closeAllDialogs()
if(infoWindow && infoWindow->ID != QueryID::NONE)
break;
if (infoWindow)
infoWindow->close();
else
GH.windows().popWindows(1);
topWindow->close();
}
if(castleInt)
castleInt->close();
castleInt = nullptr;
}
void CPlayerInterface::playerEndsTurn(PlayerColor player)

View File

@@ -341,6 +341,6 @@ WindowBase::WindowBase(int used_, Point pos_)
void WindowBase::close()
{
if(!GH.windows().isTopWindow(this))
logGlobal->error("Only top interface must be closed");
throw std::runtime_error("Only top interface can be closed");
GH.windows().popWindows(1);
}

View File

@@ -146,7 +146,6 @@ class WindowBase : public CIntObject
{
public:
WindowBase(int used_ = 0, Point pos_ = Point());
protected:
virtual void close();
};