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

changed CBonusSystemNode* to BonusList in CSkill

This commit is contained in:
Henning Koehler 2017-08-21 20:49:51 +12:00
parent fbab52eb18
commit 159e27a0ab
2 changed files with 6 additions and 7 deletions

View File

@ -29,14 +29,13 @@
///CSkill
CSkill::CSkill()
{
BonusList emptyList;
for(auto level : NSecondarySkill::levels)
bonusByLevel.push_back(new CBonusSystemNode());
bonusByLevel.push_back(emptyList);
}
CSkill::~CSkill()
{
for(auto bonus : bonusByLevel)
delete bonus;
}
void CSkill::addNewBonus(const std::shared_ptr<Bonus>& b, int level)
@ -44,10 +43,10 @@ void CSkill::addNewBonus(const std::shared_ptr<Bonus>& b, int level)
b->source = Bonus::SECONDARY_SKILL;
b->duration = Bonus::PERMANENT;
b->description = identifier;
bonusByLevel[level]->addNewBonus(b);
bonusByLevel[level].push_back(b);
}
CBonusSystemNode * CSkill::getBonus(int level)
BonusList CSkill::getBonus(int level)
{
return bonusByLevel[level];
}

View File

@ -21,14 +21,14 @@ class JsonSerializeFormat;
class DLL_LINKAGE CSkill // secondary skill
{
protected:
std::vector<CBonusSystemNode *> bonusByLevel; // bonuses provided by none, basic, advanced and expert level
std::vector<BonusList> bonusByLevel; // bonuses provided by none, basic, advanced and expert level
public:
CSkill();
~CSkill();
void addNewBonus(const std::shared_ptr<Bonus>& b, int level);
CBonusSystemNode * getBonus(int level);
BonusList getBonus(int level);
SecondarySkill id;
std::string identifier;