1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

town now updates

This commit is contained in:
Laserlicht
2023-10-14 23:41:12 +02:00
committed by GitHub
parent b89cdda718
commit c96cc405ed
4 changed files with 16 additions and 1 deletions

View File

@ -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 // Perform totalRedraw in order to force redraw of updated town list icon from adventure map
GH.windows().totalRedraw(); GH.windows().totalRedraw();
} }
for (auto cgh : GH.windows().findWindows<ITownHolder>())
cgh->buildChanged(town);
} }
void CPlayerInterface::battleStartBefore(const BattleID & battleID, const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2) void CPlayerInterface::battleStartBefore(const BattleID & battleID, const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2)

View File

@ -153,6 +153,12 @@ public:
virtual void updateGarrisons() = 0; virtual void updateGarrisons() = 0;
}; };
class ITownHolder
{
public:
virtual void buildChanged() = 0;
};
class IStatusBar class IStatusBar
{ {
public: public:

View File

@ -640,6 +640,11 @@ void CKingdomInterface::activateTab(size_t which)
tabArea->setActive(which); tabArea->setActive(which);
} }
void CKingdomInterface::buildChanged()
{
tabArea->reset();
}
void CKingdomInterface::townChanged(const CGTownInstance *town) void CKingdomInterface::townChanged(const CGTownInstance *town)
{ {
if(auto townList = std::dynamic_pointer_cast<CKingdTownList>(tabArea->getItem())) if(auto townList = std::dynamic_pointer_cast<CKingdTownList>(tabArea->getItem()))

View File

@ -200,7 +200,7 @@ public:
}; };
/// Class which holds all parts of kingdom overview window /// 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: private:
struct OwnedObjectInfo struct OwnedObjectInfo
@ -257,6 +257,7 @@ public:
void artifactMoved(const ArtifactLocation &artLoc, const ArtifactLocation &destLoc, bool withRedraw) override; void artifactMoved(const ArtifactLocation &artLoc, const ArtifactLocation &destLoc, bool withRedraw) override;
void artifactDisassembled(const ArtifactLocation &artLoc) override; void artifactDisassembled(const ArtifactLocation &artLoc) override;
void artifactAssembled(const ArtifactLocation &artLoc) override; void artifactAssembled(const ArtifactLocation &artLoc) override;
void buildChanged() override;
}; };
/// List item with town /// List item with town