diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 37ab2e637..40f508deb 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -324,6 +324,7 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details, bool verbose) if (!hero) return; + adventureInt->infoBar->requestPopAll(); if (details.result == TryMoveHero::EMBARK || details.result == TryMoveHero::DISEMBARK) { if (hero->getRemovalSound()) diff --git a/client/adventureMap/CInfoBar.cpp b/client/adventureMap/CInfoBar.cpp index e0c76e68c..f47d950e3 100644 --- a/client/adventureMap/CInfoBar.cpp +++ b/client/adventureMap/CInfoBar.cpp @@ -268,7 +268,7 @@ void CInfoBar::tick() { removeUsedEvents(TIME); if(GH.topInt() == adventureInt) - popComponents(); + popComponents(true); } void CInfoBar::clickLeft(tribool down, bool previousState) @@ -280,7 +280,7 @@ void CInfoBar::clickLeft(tribool down, bool previousState) else if(state == GAME) showDate(); else - popComponents(); + popComponents(true); } } @@ -334,6 +334,8 @@ void CInfoBar::pushComponents(const std::vector & components, std::st vect.erase(vect.begin(), vect.begin() + std::min(vect.size(), max)); }; }; + if(shouldPopAll) + popAll(); if(components.empty()) prepareComponents(components, message, timer); else @@ -421,20 +423,27 @@ void CInfoBar::prepareComponents(const std::vector & components, std: return; } +void CInfoBar::requestPopAll() +{ + shouldPopAll = true; +} + void CInfoBar::popAll() { componentsQueue = {}; + shouldPopAll = false; } -void CInfoBar::popComponents() +void CInfoBar::popComponents(bool remove) { OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE); + if(remove && !componentsQueue.empty()) + componentsQueue.pop(); if(!componentsQueue.empty()) { state = COMPONENT; const auto & extracted = componentsQueue.front(); visibleInfo = std::make_shared(extracted.first); - componentsQueue.pop(); setTimer(extracted.second); redraw(); return; diff --git a/client/adventureMap/CInfoBar.h b/client/adventureMap/CInfoBar.h index 87a3f3faa..fa6e4cd6e 100644 --- a/client/adventureMap/CInfoBar.h +++ b/client/adventureMap/CInfoBar.h @@ -138,6 +138,7 @@ private: std::shared_ptr visibleInfo; EState state; + bool shouldPopAll = false; std::queue> componentsQueue; @@ -145,7 +146,7 @@ private: void showComponents(const std::vector & comps, std::string message, int textH, bool tiny, int timer); void pushComponents(const std::vector & comps, std::string message, int textH, bool tiny, int timer); void prepareComponents(const std::vector & comps, std::string message, int timer); - void popComponents(); + void popComponents(bool remove = false); //removes all information about current state, deactivates timer (if any) void reset(); @@ -170,6 +171,9 @@ public: /// Remove all queued components void popAll(); + /// Request infobar to pop all after next InfoWindow arrives. + void requestPopAll(); + /// print enemy turn progress void startEnemyTurn(PlayerColor color);