1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

picked art fixed

This commit is contained in:
SoundSSGood
2023-07-17 22:24:43 +03:00
parent f23de91fad
commit f33dec9337
4 changed files with 8 additions and 16 deletions

View File

@@ -114,8 +114,7 @@ CHeroSwitcher::CHeroSwitcher(CHeroWindow * owner_, Point pos_, const CGHeroInsta
}
CHeroWindow::CHeroWindow(const CGHeroInstance * hero)
: CStatusbarWindow(PLAYER_COLORED, "HeroScr4"),
heroWArt(this, hero)
: CStatusbarWindow(PLAYER_COLORED, "HeroScr4")
{
auto & heroscrn = CGI->generaltexth->heroscrn;
@@ -268,7 +267,7 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded)
//primary skills support
for(size_t g=0; g<primSkillAreas.size(); ++g)
{
primSkillAreas[g]->bonusValue = heroWArt.getPrimSkillLevel(static_cast<PrimarySkill::PrimarySkill>(g));
primSkillAreas[g]->bonusValue = curHero->getPrimSkillLevel(static_cast<PrimarySkill::PrimarySkill>(g));
primSkillValues[g]->setText(std::to_string(primSkillAreas[g]->bonusValue));
}
@@ -294,7 +293,7 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded)
expValue->setText(expstr.str());
std::ostringstream manastr;
manastr << curHero->mana << '/' << heroWArt.manaLimit();
manastr << curHero->mana << '/' << curHero->manaLimit();
manaValue->setText(manastr.str());
//printing experience - original format does not support ui64
@@ -307,7 +306,7 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded)
spellPointsArea->text = CGI->generaltexth->allTexts[205];
boost::replace_first(spellPointsArea->text, "%s", curHero->getNameTranslated());
boost::replace_first(spellPointsArea->text, "%d", std::to_string(curHero->mana));
boost::replace_first(spellPointsArea->text, "%d", std::to_string(heroWArt.manaLimit()));
boost::replace_first(spellPointsArea->text, "%d", std::to_string(curHero->manaLimit()));
//if we have exchange window with this curHero open
bool noDismiss=false;
@@ -343,8 +342,8 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded)
formations->setSelected(curHero->formation == EArmyFormation::TIGHT ? 1 : 0);
formations->addCallback([=](int value){ LOCPLINT->cb->setFormation(curHero, value);});
morale->set(&heroWArt);
luck->set(&heroWArt);
morale->set(curHero);
luck->set(curHero);
if(redrawNeeded)
redraw();
@@ -390,5 +389,5 @@ void CHeroWindow::commanderWindow()
void CHeroWindow::updateGarrisons()
{
garr->recreateSlots();
morale->set(&heroWArt);
morale->set(curHero);
}

View File

@@ -97,8 +97,6 @@ class CHeroWindow : public CStatusbarWindow, public CGarrisonHolder, public CWin
std::vector<std::shared_ptr<CLabel>> secSkillNames;
std::vector<std::shared_ptr<CLabel>> secSkillValues;
CHeroWithMaybePickedArtifact heroWArt;
std::shared_ptr<CButton> quitButton;
std::shared_ptr<CTextBox> dismissLabel;
std::shared_ptr<CButton> dismissButton;

View File

@@ -912,8 +912,6 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
{
const CGHeroInstance * hero = heroInst.at(leftRight);
herosWArt[leftRight] = std::make_shared<CHeroWithMaybePickedArtifact>(this, hero);
for(int m=0; m<GameConstants::PRIMARY_SKILLS; ++m)
primSkillValues[leftRight].push_back(std::make_shared<CLabel>(352 + (qeLayout ? 96 : 93) * leftRight, (qeLayout ? 22 : 35) + (qeLayout ? 26 : 36) * m, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE));
@@ -1079,7 +1077,7 @@ void CExchangeWindow::updateWidgets()
for(int m=0; m<GameConstants::PRIMARY_SKILLS; ++m)
{
auto value = herosWArt[leftRight]->getPrimSkillLevel(static_cast<PrimarySkill::PrimarySkill>(m));
auto value = heroInst[leftRight]->getPrimSkillLevel(static_cast<PrimarySkill::PrimarySkill>(m));
primSkillValues[leftRight][m]->setText(std::to_string(value));
}

View File

@@ -38,7 +38,6 @@ class CToggleButton;
class CGStatusBar;
class CTextBox;
class CResDataBar;
class CHeroWithMaybePickedArtifact;
enum class EUserEvent;
@@ -288,8 +287,6 @@ private:
class CExchangeWindow : public CStatusbarWindow, public CGarrisonHolder, public CWindowWithArtifacts
{
std::array<std::shared_ptr<CHeroWithMaybePickedArtifact>, 2> herosWArt;
std::array<std::shared_ptr<CLabel>, 2> titles;
std::vector<std::shared_ptr<CAnimImage>> primSkillImages;//shared for both heroes
std::array<std::vector<std::shared_ptr<CLabel>>, 2> primSkillValues;