mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fix for hero info window mana points not getting spent on spellcast
This commit is contained in:
@@ -584,7 +584,15 @@ 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)
|
||||||
|
@@ -389,6 +389,12 @@ HeroInfoBasicPanel::HeroInfoBasicPanel(const InfoAboutHero & hero, Point * posit
|
|||||||
background->colorize(hero.owner);
|
background->colorize(hero.owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initializeData(hero);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HeroInfoBasicPanel::initializeData(const InfoAboutHero & hero)
|
||||||
|
{
|
||||||
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||||
auto attack = hero.details->primskills[0];
|
auto attack = hero.details->primskills[0];
|
||||||
auto defense = hero.details->primskills[1];
|
auto defense = hero.details->primskills[1];
|
||||||
auto power = hero.details->primskills[2];
|
auto power = hero.details->primskills[2];
|
||||||
@@ -423,6 +429,14 @@ HeroInfoBasicPanel::HeroInfoBasicPanel(const InfoAboutHero & hero, Point * posit
|
|||||||
labels.push_back(std::make_shared<CLabel>(39, 186, EFonts::FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, std::to_string(currentSpellPoints) + "/" + std::to_string(maxSpellPoints)));
|
labels.push_back(std::make_shared<CLabel>(39, 186, EFonts::FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, std::to_string(currentSpellPoints) + "/" + std::to_string(maxSpellPoints)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HeroInfoBasicPanel::update(const InfoAboutHero & updatedInfo)
|
||||||
|
{
|
||||||
|
icons.clear();
|
||||||
|
labels.clear();
|
||||||
|
|
||||||
|
initializeData(updatedInfo);
|
||||||
|
}
|
||||||
|
|
||||||
void HeroInfoBasicPanel::show(Canvas & to)
|
void HeroInfoBasicPanel::show(Canvas & to)
|
||||||
{
|
{
|
||||||
showAll(to);
|
showAll(to);
|
||||||
|
@@ -137,6 +137,9 @@ public:
|
|||||||
HeroInfoBasicPanel(const InfoAboutHero & hero, Point * position, bool initializeBackground = true);
|
HeroInfoBasicPanel(const InfoAboutHero & hero, Point * position, bool initializeBackground = true);
|
||||||
|
|
||||||
void show(Canvas & to) override;
|
void show(Canvas & to) override;
|
||||||
|
|
||||||
|
void initializeData(const InfoAboutHero & hero);
|
||||||
|
void update(const InfoAboutHero & updatedInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
class HeroInfoWindow : public CWindowObject
|
class HeroInfoWindow : public CWindowObject
|
||||||
|
@@ -237,8 +237,8 @@ void BattleWindow::showStickyHeroWindows()
|
|||||||
if(settings["battle"]["stickyHeroInfoWindows"].Bool() == true)
|
if(settings["battle"]["stickyHeroInfoWindows"].Bool() == true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Settings showStickyHeroInfoWIndows = settings.write["battle"]["stickyHeroInfoWindows"];
|
Settings showStickyHeroInfoWindows = settings.write["battle"]["stickyHeroInfoWindows"];
|
||||||
showStickyHeroInfoWIndows->Bool() = true;
|
showStickyHeroInfoWindows->Bool() = true;
|
||||||
|
|
||||||
|
|
||||||
createStickyHeroInfoWindows();
|
createStickyHeroInfoWindows();
|
||||||
@@ -250,6 +250,12 @@ void BattleWindow::updateQueue()
|
|||||||
queue->update();
|
queue->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BattleWindow::updateHeroInfoWindow(uint8_t side, const InfoAboutHero & hero)
|
||||||
|
{
|
||||||
|
std::shared_ptr<HeroInfoBasicPanel> panelToUpdate = side == 0 ? attackerHeroWindow : defenderHeroWindow;
|
||||||
|
panelToUpdate->update(hero);
|
||||||
|
}
|
||||||
|
|
||||||
void BattleWindow::activate()
|
void BattleWindow::activate()
|
||||||
{
|
{
|
||||||
GH.setStatusbar(console);
|
GH.setStatusbar(console);
|
||||||
|
@@ -88,6 +88,9 @@ public:
|
|||||||
/// Refresh queue after turn order changes
|
/// Refresh queue after turn order changes
|
||||||
void updateQueue();
|
void updateQueue();
|
||||||
|
|
||||||
|
/// Refresh sticky variant of hero info window after spellcast, side same as in BattleSpellCast::side
|
||||||
|
void updateHeroInfoWindow(uint8_t side, const InfoAboutHero & hero);
|
||||||
|
|
||||||
/// Get mouse-hovered battle queue unit ID if any found
|
/// Get mouse-hovered battle queue unit ID if any found
|
||||||
std::optional<uint32_t> getQueueHoveredUnitId();
|
std::optional<uint32_t> getQueueHoveredUnitId();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user