1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
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)

View File

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

View File

@ -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<CKingdTownList>(tabArea->getItem()))

View File

@ -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