Parcourir la source

added debug info to skill loading

Henning Koehler il y a 8 ans
Parent
commit
d8648288f0
2 fichiers modifiés avec 10 ajouts et 0 suppressions
  1. 9 0
      lib/CSkillHandler.cpp
  2. 1 0
      lib/CSkillHandler.h

+ 9 - 0
lib/CSkillHandler.cpp

@@ -56,6 +56,12 @@ BonusList CSkill::getBonus(int level)
     return bonusByLevel[level];
 }
 
+DLL_LINKAGE std::ostream & operator<<(std::ostream &out, const CSkill &skill)
+{
+	out << "Skill(" << (int)skill.id << "," << skill.identifier << "): " << skill.bonusByLevel;
+	return out;
+}
+
 ///CSkillHandler
 CSkillHandler::CSkillHandler()
 {
@@ -109,6 +115,9 @@ CSkill * CSkillHandler::loadFromJson(const JsonNode & json, const std::string &
             skill->addNewBonus(bonus, level);
         }
     }
+    CLogger * logger = CLogger::getLogger(CLoggerDomain("skills"));
+    logger->debugStream() << "loaded secondary skill " << identifier << "(" << (int)skill->id << ")";
+    logger->traceStream() << *skill;
 
     return skill;
 }

+ 1 - 0
lib/CSkillHandler.h

@@ -40,6 +40,7 @@ public:
     }
 
     friend class CSkillHandler;
+    friend std::ostream & operator<<(std::ostream &out, const CSkill &skill);
 };
 
 class DLL_LINKAGE CSkillHandler: public CHandlerBase<SecondarySkill, CSkill>