Browse Source

changed CBonusSystemNode* to BonusList in CSkill

Henning Koehler 8 years ago
parent
commit
159e27a0ab
2 changed files with 6 additions and 7 deletions
  1. 4 5
      lib/CSkillHandler.cpp
  2. 2 2
      lib/CSkillHandler.h

+ 4 - 5
lib/CSkillHandler.cpp

@@ -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];
 }

+ 2 - 2
lib/CSkillHandler.h

@@ -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;