1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +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::CSkill() CSkill::CSkill()
{ {
BonusList emptyList;
for(auto level : NSecondarySkill::levels) for(auto level : NSecondarySkill::levels)
bonusByLevel.push_back(new CBonusSystemNode()); bonusByLevel.push_back(emptyList);
} }
CSkill::~CSkill() CSkill::~CSkill()
{ {
for(auto bonus : bonusByLevel)
delete bonus;
} }
void CSkill::addNewBonus(const std::shared_ptr<Bonus>& b, int level) 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->source = Bonus::SECONDARY_SKILL;
b->duration = Bonus::PERMANENT; b->duration = Bonus::PERMANENT;
b->description = identifier; 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]; return bonusByLevel[level];
} }

View File

@ -21,14 +21,14 @@ class JsonSerializeFormat;
class DLL_LINKAGE CSkill // secondary skill class DLL_LINKAGE CSkill // secondary skill
{ {
protected: 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: public:
CSkill(); CSkill();
~CSkill(); ~CSkill();
void addNewBonus(const std::shared_ptr<Bonus>& b, int level); void addNewBonus(const std::shared_ptr<Bonus>& b, int level);
CBonusSystemNode * getBonus(int level); BonusList getBonus(int level);
SecondarySkill id; SecondarySkill id;
std::string identifier; std::string identifier;