MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / SkillManager

Method SkillManager

source/game/SkillManager.cpp:230–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228};
229
230SkillManager::SkillManager() :
231 mSkills(static_cast<uint32_t>(SkillType::countSkill)),
232 mSkillsFamily(static_cast<uint32_t>(SkillFamily::nb))
233{
234 for (uint32_t i = 0; i < static_cast<uint32_t>(SkillFamily::nb); ++i)
235 {
236 std::vector<SkillType>& family = mSkillsFamily.at(i);
237 SkillFamily resFamily = static_cast<SkillFamily>(i);
238 switch(resFamily)
239 {
240 case SkillFamily::rooms:
241 family = std::vector<SkillType>(static_cast<uint32_t>(RoomType::nbRooms), SkillType::nullSkillType);
242 break;
243 case SkillFamily::traps:
244 family = std::vector<SkillType>(static_cast<uint32_t>(TrapType::nbTraps), SkillType::nullSkillType);
245 break;
246 case SkillFamily::spells:
247 family = std::vector<SkillType>(static_cast<uint32_t>(SpellType::nbSpells), SkillType::nullSkillType);
248 break;
249 default:
250 OD_LOG_ERR("Wrong enum value=" + Helper::toString(static_cast<uint32_t>(resFamily)) + ", size=" + Helper::toString(static_cast<uint32_t>(SkillFamily::nb)));
251 break;
252 }
253 }
254
255 // We build the skill tree
256 SkillDef* def;
257 SkillType resType;
258 int32_t points;
259 std::vector<const Skill*> emptyDepends;
260 std::vector<const Skill*> lvl1depends;
261 std::vector<const Skill*> lvl2depends;
262 std::vector<const Skill*> lvl3depends;
263 std::vector<const Skill*> lvl4depends;
264 Skill* skill;
265 uint32_t index;
266
267 // Attack Skills
268
269 // Lvl 1 skills
270 resType = SkillType::roomTrainingHall;
271 index = static_cast<uint32_t>(resType);
272 points = ConfigManager::getSingleton().getSkillPoints(Skills::toString(resType));
273 skill = new Skill(resType, points, emptyDepends);
274 def = new SkillDefRoom("AttackSkills/", "TrainingHallButton", skill, RoomType::trainingHall);
275 def->mapSkill(mSkillsFamily);
276 mSkills[index] = def;
277 lvl1depends.push_back(skill);
278
279 resType = SkillType::roomBridgeWooden;
280 index = static_cast<uint32_t>(resType);
281 points = ConfigManager::getSingleton().getSkillPoints(Skills::toString(resType));
282 skill = new Skill(resType, points, emptyDepends);
283 def = new SkillDefRoom("AttackSkills/", "WoodenBridgeButton", skill, RoomType::bridgeWooden);
284 def->mapSkill(mSkillsFamily);
285 mSkills[index] = def;
286 lvl1depends.push_back(skill);
287

Callers

nothing calls this directly

Calls 4

clearMethod · 0.80
toStringFunction · 0.70
getSkillPointsMethod · 0.45
mapSkillMethod · 0.45

Tested by

no test coverage detected