Make LearnedAttack of Creature a smart pointer.
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user