mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-15 22:16:37 +02:00
Fix broken grandmaster ability description updating on select/deselect
This commit is contained in:
parent
dacf6c9d08
commit
2769782d0a
@ -128,6 +128,11 @@ void CCommanderSkillIcon::deselect()
|
|||||||
isSelected = false;
|
isSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CCommanderSkillIcon::getIsGrandmasterAbility()
|
||||||
|
{
|
||||||
|
return isGrandmasterAbility;
|
||||||
|
}
|
||||||
|
|
||||||
void CCommanderSkillIcon::show(Canvas &to)
|
void CCommanderSkillIcon::show(Canvas &to)
|
||||||
{
|
{
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
@ -914,8 +919,11 @@ void CStackWindow::setSelection(si32 newSkill, std::shared_ptr<CCommanderSkillIc
|
|||||||
selectedIcon->setObject(std::make_shared<CPicture>(getSkillImage(oldSelection)));
|
selectedIcon->setObject(std::make_shared<CPicture>(getSkillImage(oldSelection)));
|
||||||
|
|
||||||
if(selectedIcon)
|
if(selectedIcon)
|
||||||
|
{
|
||||||
|
if(!selectedIcon->getIsGrandmasterAbility()) //unlike WoG, in VCMI grandmaster skill descriptions are taken from bonus descriptions
|
||||||
{
|
{
|
||||||
selectedIcon->text = getSkillDescription(oldSelection, false); //update previously selected icon's message to existing skill level
|
selectedIcon->text = getSkillDescription(oldSelection, false); //update previously selected icon's message to existing skill level
|
||||||
|
}
|
||||||
selectedIcon->deselect();
|
selectedIcon->deselect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,9 +931,12 @@ void CStackWindow::setSelection(si32 newSkill, std::shared_ptr<CCommanderSkillIc
|
|||||||
if(newSkill < 100)
|
if(newSkill < 100)
|
||||||
{
|
{
|
||||||
newIcon->setObject(std::make_shared<CPicture>(getSkillImage(newSkill)));
|
newIcon->setObject(std::make_shared<CPicture>(getSkillImage(newSkill)));
|
||||||
|
if(!newIcon->getIsGrandmasterAbility())
|
||||||
|
{
|
||||||
newIcon->text = getSkillDescription(newSkill, true); //update currently selected icon's message to show upgrade description
|
newIcon->text = getSkillDescription(newSkill, true); //update currently selected icon's message to show upgrade description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<CIntObject> CStackWindow::switchTab(size_t index)
|
std::shared_ptr<CIntObject> CStackWindow::switchTab(size_t index)
|
||||||
{
|
{
|
||||||
|
@ -43,6 +43,7 @@ public:
|
|||||||
|
|
||||||
void setObject(std::shared_ptr<CIntObject> object);
|
void setObject(std::shared_ptr<CIntObject> object);
|
||||||
void deselect(); //TODO: consider using observer pattern instead?
|
void deselect(); //TODO: consider using observer pattern instead?
|
||||||
|
bool getIsGrandmasterAbility();
|
||||||
|
|
||||||
void show(Canvas &to) override;
|
void show(Canvas &to) override;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user