1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

renamed CGHeroInstance::updateSkill to updateSkillBonus

This commit is contained in:
Henning Koehler 2018-03-05 20:02:23 +13:00 committed by ArseniyShestakov
parent d3e4fc6e7a
commit 6263c4c3eb
2 changed files with 6 additions and 5 deletions

View File

@ -157,7 +157,7 @@ void CGHeroInstance::setSecSkillLevel(SecondarySkill which, int val, bool abs)
if(getSecSkillLevel(which) == 0) if(getSecSkillLevel(which) == 0)
{ {
secSkills.push_back(std::pair<SecondarySkill,ui8>(which, val)); secSkills.push_back(std::pair<SecondarySkill,ui8>(which, val));
updateSkill(which, val); updateSkillBonus(which, val);
} }
else else
{ {
@ -175,7 +175,7 @@ void CGHeroInstance::setSecSkillLevel(SecondarySkill which, int val, bool abs)
logGlobal->warn("Skill %d increased over limit! Decreasing to Expert.", static_cast<int>(which.toEnum())); logGlobal->warn("Skill %d increased over limit! Decreasing to Expert.", static_cast<int>(which.toEnum()));
elem.second = 3; elem.second = 3;
} }
updateSkill(which, elem.second); //when we know final value updateSkillBonus(which, elem.second); //when we know final value
} }
} }
} }
@ -537,7 +537,7 @@ void CGHeroInstance::recreateSecondarySkillsBonuses()
for(auto skill_info : secSkills) for(auto skill_info : secSkills)
if(skill_info.second > 0) if(skill_info.second > 0)
updateSkill(SecondarySkill(skill_info.first), skill_info.second); updateSkillBonus(SecondarySkill(skill_info.first), skill_info.second);
} }
void CGHeroInstance::recreateSpecialtyBonuses(std::vector<HeroSpecial *> & specialtyDeprecated) void CGHeroInstance::recreateSpecialtyBonuses(std::vector<HeroSpecial *> & specialtyDeprecated)
@ -557,13 +557,14 @@ void CGHeroInstance::recreateSpecialtyBonuses(std::vector<HeroSpecial *> & speci
} }
} }
void CGHeroInstance::updateSkill(SecondarySkill which, int val) void CGHeroInstance::updateSkillBonus(SecondarySkill which, int val)
{ {
removeBonuses(Selector::source(Bonus::SECONDARY_SKILL, which)); removeBonuses(Selector::source(Bonus::SECONDARY_SKILL, which));
auto skillBonus = (*VLC->skillh)[which]->getBonus(val); auto skillBonus = (*VLC->skillh)[which]->getBonus(val);
for (auto b : skillBonus) for (auto b : skillBonus)
addNewBonus(std::make_shared<Bonus>(*b)); addNewBonus(std::make_shared<Bonus>(*b));
} }
void CGHeroInstance::setPropertyDer( ui8 what, ui32 val ) void CGHeroInstance::setPropertyDer( ui8 what, ui32 val )
{ {
if(what == ObjProperty::PRIMARY_STACK_COUNT) if(what == ObjProperty::PRIMARY_STACK_COUNT)

View File

@ -215,7 +215,7 @@ public:
ui8 maxlevelsToMagicSchool() const; ui8 maxlevelsToMagicSchool() const;
ui8 maxlevelsToWisdom() const; ui8 maxlevelsToWisdom() const;
void recreateSecondarySkillsBonuses(); void recreateSecondarySkillsBonuses();
void updateSkill(SecondarySkill which, int val); void updateSkillBonus(SecondarySkill which, int val);
bool hasVisions(const CGObjectInstance * target, const int subtype) const; bool hasVisions(const CGObjectInstance * target, const int subtype) const;
/// If this hero perishes, the scenario is failed /// If this hero perishes, the scenario is failed