Remove shared_ptr, instead use borrowed_ptr to more accurately depict ownership of the objects in the BaseLibraries.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-05-26 14:13:30 +02:00
parent d82792e27a
commit 36208da2fb
11 changed files with 63 additions and 63 deletions

View File

@@ -1,19 +1,18 @@
#include "LearnedAttack.hpp"
#include <Arbutils/Assert.hpp>
CreatureLib::Battling::LearnedAttack::LearnedAttack(
const std::shared_ptr<const CreatureLib::Library::AttackData>& attack, uint8_t maxUses,
AttackLearnMethod learnMethod)
CreatureLib::Battling::LearnedAttack::LearnedAttack(const borrowed_ptr<const CreatureLib::Library::AttackData>& attack,
uint8_t maxUses, AttackLearnMethod learnMethod)
: _attack(attack), _maxUses(maxUses), _remainingUses(maxUses), _learnMethod(learnMethod) {
AssertNotNull(_attack)
}
CreatureLib::Battling::LearnedAttack::LearnedAttack(
const std::shared_ptr<const CreatureLib::Library::AttackData>& attack, AttackLearnMethod learnMethod)
CreatureLib::Battling::LearnedAttack::LearnedAttack(const borrowed_ptr<const CreatureLib::Library::AttackData>& attack,
AttackLearnMethod learnMethod)
: _attack(attack), _maxUses(attack->GetBaseUsages()), _remainingUses(_maxUses), _learnMethod(learnMethod) {
AssertNotNull(_attack)
}
const std::shared_ptr<const CreatureLib::Library::AttackData>&
const borrowed_ptr<const CreatureLib::Library::AttackData>&
CreatureLib::Battling::LearnedAttack::GetAttack() const noexcept {
return _attack;
}