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
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,26 +1,27 @@
|
||||
#ifndef CREATURELIB_LEARNEDATTACK_HPP
|
||||
#define CREATURELIB_LEARNEDATTACK_HPP
|
||||
|
||||
#include <Arbutils/Memory/borrowed_ptr.hpp>
|
||||
#include <memory>
|
||||
#include "../../Library/Attacks/AttackData.hpp"
|
||||
#include "AttackLearnMethod.hpp"
|
||||
|
||||
namespace CreatureLib::Battling {
|
||||
class LearnedAttack {
|
||||
std::shared_ptr<const Library::AttackData> _attack;
|
||||
borrowed_ptr<const Library::AttackData> _attack;
|
||||
uint8_t _maxUses;
|
||||
uint8_t _remainingUses;
|
||||
AttackLearnMethod _learnMethod;
|
||||
|
||||
public:
|
||||
LearnedAttack(const std::shared_ptr<const CreatureLib::Library::AttackData>& attack, uint8_t maxUses,
|
||||
LearnedAttack(const borrowed_ptr<const CreatureLib::Library::AttackData>& attack, uint8_t maxUses,
|
||||
AttackLearnMethod learnMethod);
|
||||
LearnedAttack(const std::shared_ptr<const CreatureLib::Library::AttackData>& attack,
|
||||
LearnedAttack(const borrowed_ptr<const CreatureLib::Library::AttackData>& attack,
|
||||
AttackLearnMethod learnMethod);
|
||||
|
||||
virtual ~LearnedAttack() = default;
|
||||
|
||||
const std::shared_ptr<const Library::AttackData>& GetAttack() const noexcept;
|
||||
const borrowed_ptr<const Library::AttackData>& GetAttack() const noexcept;
|
||||
uint8_t GetMaxUses() const noexcept;
|
||||
uint8_t GetRemainingUses() const noexcept;
|
||||
AttackLearnMethod GetLearnMethod() const noexcept;
|
||||
|
||||
Reference in New Issue
Block a user