mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-17 20:58:07 +02:00
Ignore garrison update events of another towns for our castleInt
This commit is contained in:
parent
a16d47037e
commit
2af7d7c085
@ -479,24 +479,14 @@ void CPlayerInterface::heroInGarrisonChange(const CGTownInstance *town)
|
||||
adventureInt->onHeroChanged(nullptr);
|
||||
adventureInt->onTownChanged(town);
|
||||
|
||||
if(castleInt)
|
||||
{
|
||||
castleInt->garr->selectSlot(nullptr);
|
||||
castleInt->garr->setArmy(town->getUpperArmy(), EGarrisonType::UPPER);
|
||||
castleInt->garr->setArmy(town->visitingHero, EGarrisonType::LOWER);
|
||||
castleInt->garr->recreateSlots();
|
||||
castleInt->heroes->update();
|
||||
|
||||
// Perform totalRedraw to update hero list on adventure map
|
||||
GH.windows().totalRedraw();
|
||||
}
|
||||
for (auto gh : GH.windows().findWindows<IGarrisonHolder>())
|
||||
gh->updateGarrisons();
|
||||
|
||||
for (auto ki : GH.windows().findWindows<CKingdomInterface>())
|
||||
{
|
||||
ki->townChanged(town);
|
||||
ki->updateGarrisons();
|
||||
ki->redraw();
|
||||
}
|
||||
|
||||
// Perform totalRedraw to update hero list on adventure map, if any dialogs are open
|
||||
GH.windows().totalRedraw();
|
||||
}
|
||||
|
||||
void CPlayerInterface::heroVisitsTown(const CGHeroInstance* hero, const CGTownInstance * town)
|
||||
@ -1126,7 +1116,8 @@ void CPlayerInterface::availableCreaturesChanged( const CGDwelling *town )
|
||||
fortScreen->creaturesChangedEventHandler();
|
||||
|
||||
for (auto castleInterface : GH.windows().findWindows<CCastleInterface>())
|
||||
castleInterface->creaturesChangedEventHandler();
|
||||
if(castleInterface->town == town)
|
||||
castleInterface->creaturesChangedEventHandler();
|
||||
|
||||
if (townObj)
|
||||
for (auto ki : GH.windows().findWindows<CKingdomInterface>())
|
||||
@ -1414,9 +1405,9 @@ void CPlayerInterface::objectRemovedAfter()
|
||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||
adventureInt->onMapTilesChanged(boost::none);
|
||||
|
||||
// visiting or garrisoned hero removed - recreate castle window
|
||||
// visiting or garrisoned hero removed - update window
|
||||
if (castleInt)
|
||||
openTownWindow(castleInt->town);
|
||||
castleInt->updateGarrisons();
|
||||
|
||||
for (auto ki : GH.windows().findWindows<CKingdomInterface>())
|
||||
ki->heroRemoved();
|
||||
|
@ -1213,7 +1213,12 @@ CCastleInterface::~CCastleInterface()
|
||||
|
||||
void CCastleInterface::updateGarrisons()
|
||||
{
|
||||
garr->setArmy(town->getUpperArmy(), EGarrisonType::UPPER);
|
||||
garr->setArmy(town->visitingHero, EGarrisonType::LOWER);
|
||||
garr->recreateSlots();
|
||||
heroes->update();
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void CCastleInterface::close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user