Make LearnedAttack of Creature a smart pointer.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-05-31 17:26:39 +02:00
parent a7069a5960
commit ff181204ae
8 changed files with 25 additions and 21 deletions

View File

@@ -40,12 +40,12 @@ namespace CreatureLib::Battling {
uint8_t _numberHits;
HitData* _hits;
Creature* _user;
LearnedAttack* _attack;
ArbUt::BorrowedPtr<LearnedAttack> _attack;
Script* _script;
public:
ExecutingAttack(const ArbUt::List<Creature*>& targets, uint8_t numberHits, Creature* user,
LearnedAttack* attack, Script* script)
const ArbUt::BorrowedPtr<LearnedAttack>& attack, Script* script)
: _targets(targets.Count()), _numberHits(numberHits), _hits(new HitData[targets.Count() * numberHits]),
_user(user), _attack(attack), _script(script) {
AssertNotNull(user)
@@ -87,7 +87,7 @@ namespace CreatureLib::Battling {
Creature* GetUser() noexcept { return _user; }
LearnedAttack* GetAttack() noexcept { return _attack; }
const ArbUt::BorrowedPtr<LearnedAttack>& GetAttack() noexcept { return _attack; }
size_t ScriptCount() const override { return _user->ScriptCount() + 1; }
protected: