diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index ea49a74fd..f68d8d58d 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -591,6 +591,9 @@ void CPlayerInterface::buildChanged(const CGTownInstance *town, BuildingID build // Perform totalRedraw in order to force redraw of updated town list icon from adventure map GH.windows().totalRedraw(); } + + for (auto cgh : GH.windows().findWindows()) + cgh->buildChanged(town); } void CPlayerInterface::battleStartBefore(const BattleID & battleID, const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2) diff --git a/client/gui/CIntObject.h b/client/gui/CIntObject.h index 5833ddac3..6ea72ed56 100644 --- a/client/gui/CIntObject.h +++ b/client/gui/CIntObject.h @@ -153,6 +153,12 @@ public: virtual void updateGarrisons() = 0; }; +class ITownHolder +{ +public: + virtual void buildChanged() = 0; +}; + class IStatusBar { public: diff --git a/client/windows/CKingdomInterface.cpp b/client/windows/CKingdomInterface.cpp index 390ba1cb5..81426a045 100644 --- a/client/windows/CKingdomInterface.cpp +++ b/client/windows/CKingdomInterface.cpp @@ -640,6 +640,11 @@ void CKingdomInterface::activateTab(size_t which) tabArea->setActive(which); } +void CKingdomInterface::buildChanged() +{ + tabArea->reset(); +} + void CKingdomInterface::townChanged(const CGTownInstance *town) { if(auto townList = std::dynamic_pointer_cast(tabArea->getItem())) diff --git a/client/windows/CKingdomInterface.h b/client/windows/CKingdomInterface.h index a9a7d7cc4..31097a58c 100644 --- a/client/windows/CKingdomInterface.h +++ b/client/windows/CKingdomInterface.h @@ -200,7 +200,7 @@ public: }; /// Class which holds all parts of kingdom overview window -class CKingdomInterface : public CWindowObject, public IGarrisonHolder, public CArtifactHolder +class CKingdomInterface : public CWindowObject, public IGarrisonHolder, public CArtifactHolder, public ITownHolder { private: struct OwnedObjectInfo @@ -257,6 +257,7 @@ public: void artifactMoved(const ArtifactLocation &artLoc, const ArtifactLocation &destLoc, bool withRedraw) override; void artifactDisassembled(const ArtifactLocation &artLoc) override; void artifactAssembled(const ArtifactLocation &artLoc) override; + void buildChanged() override; }; /// List item with town