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

Method addSkillPoints

source/game/Seat.cpp:1340–1364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1338}
1339
1340void Seat::addSkillPoints(int32_t points)
1341{
1342 // Even if we are not searching anything, we allow to bring back a skill book if
1343 // we find any
1344 mSkillPoints += points;
1345 if(mCurrentSkill == nullptr)
1346 {
1347 mCurrentSkillType = SkillType::nullSkillType;
1348 return;
1349 }
1350
1351 if(mSkillPoints < mCurrentSkill->getNeededSkillPoints())
1352 {
1353 mCurrentSkillType = mCurrentSkill->getType();
1354 mCurrentSkillProgress = static_cast<float>(mSkillPoints) / static_cast<float>(mCurrentSkill->getNeededSkillPoints());
1355 return;
1356 }
1357
1358 // The current skill is complete. We add it to the available skill list
1359 mSkillPoints -= mCurrentSkill->getNeededSkillPoints();
1360 addSkill(mCurrentSkill->getType());
1361
1362 // We set the next skill
1363 setNextSkill(mCurrentSkill->getType());
1364}
1365
1366bool Seat::getCurrentSkillProgress(SkillType& type, float& progress) const
1367{

Callers 1

Calls 2

getNeededSkillPointsMethod · 0.80
getTypeMethod · 0.45

Tested by

no test coverage detected