mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Improve feature by triggering hero window refresh in response to netpack
This commit is contained in:
@@ -476,6 +476,9 @@ void CPlayerInterface::heroManaPointsChanged(const CGHeroInstance * hero)
|
|||||||
adventureInt->onHeroChanged(hero);
|
adventureInt->onHeroChanged(hero);
|
||||||
if (makingTurn && hero->tempOwner == playerID)
|
if (makingTurn && hero->tempOwner == playerID)
|
||||||
adventureInt->onHeroChanged(hero);
|
adventureInt->onHeroChanged(hero);
|
||||||
|
|
||||||
|
for (auto window : GH.windows().findWindows<BattleWindow>())
|
||||||
|
window->heroManaPointsChanged(hero);
|
||||||
}
|
}
|
||||||
void CPlayerInterface::heroMovePointsChanged(const CGHeroInstance * hero)
|
void CPlayerInterface::heroMovePointsChanged(const CGHeroInstance * hero)
|
||||||
{
|
{
|
||||||
|
@@ -584,15 +584,7 @@ void BattleInterface::endAction(const BattleAction* action)
|
|||||||
|
|
||||||
//we have activated next stack after sending request that has been just realized -> blockmap due to movement has changed
|
//we have activated next stack after sending request that has been just realized -> blockmap due to movement has changed
|
||||||
if(action->actionType == EActionType::HERO_SPELL)
|
if(action->actionType == EActionType::HERO_SPELL)
|
||||||
{
|
|
||||||
fieldController->redrawBackgroundWithHexes();
|
fieldController->redrawBackgroundWithHexes();
|
||||||
|
|
||||||
//update casting hero info window
|
|
||||||
auto hero = action->side == 0 ? attackingHero : defendingHero;
|
|
||||||
InfoAboutHero heroInfo = InfoAboutHero();
|
|
||||||
heroInfo.initFromHero(hero->instance(), InfoAboutHero::INBATTLE);
|
|
||||||
windowObject->updateHeroInfoWindow(action->side, heroInfo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleInterface::appendBattleLog(const std::string & newEntry)
|
void BattleInterface::appendBattleLog(const std::string & newEntry)
|
||||||
|
@@ -256,6 +256,21 @@ void BattleWindow::updateHeroInfoWindow(uint8_t side, const InfoAboutHero & hero
|
|||||||
panelToUpdate->update(hero);
|
panelToUpdate->update(hero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BattleWindow::heroManaPointsChanged(const CGHeroInstance * hero)
|
||||||
|
{
|
||||||
|
if(hero == owner.attackingHeroInstance || hero == owner.defendingHeroInstance)
|
||||||
|
{
|
||||||
|
InfoAboutHero heroInfo = InfoAboutHero();
|
||||||
|
heroInfo.initFromHero(hero, InfoAboutHero::INBATTLE);
|
||||||
|
|
||||||
|
updateHeroInfoWindow(hero == owner.attackingHeroInstance ? 0 : 1, heroInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logGlobal->error("BattleWindow::heroManaPointsChanged: 'Mana points changed' called for hero not belonging to current battle window");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BattleWindow::activate()
|
void BattleWindow::activate()
|
||||||
{
|
{
|
||||||
GH.setStatusbar(console);
|
GH.setStatusbar(console);
|
||||||
|
@@ -79,9 +79,13 @@ public:
|
|||||||
void hideQueue();
|
void hideQueue();
|
||||||
void showQueue();
|
void showQueue();
|
||||||
|
|
||||||
|
/// Toggle permanent hero info windows visibility (HD mod feature)
|
||||||
void hideStickyHeroWindows();
|
void hideStickyHeroWindows();
|
||||||
void showStickyHeroWindows();
|
void showStickyHeroWindows();
|
||||||
|
|
||||||
|
/// Event handler for netpack changing hero mana points
|
||||||
|
void heroManaPointsChanged(const CGHeroInstance * hero);
|
||||||
|
|
||||||
/// block all UI elements when player is not allowed to act, e.g. during enemy turn
|
/// block all UI elements when player is not allowed to act, e.g. during enemy turn
|
||||||
void blockUI(bool on);
|
void blockUI(bool on);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user