From 49e8ff055d261d1c7d0e442e1cc59284888e5361 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 2 Jun 2020 12:16:26 +0200 Subject: [PATCH] Use smart pointer for BattleParty. --- src/Battling/Models/BattleParty.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Battling/Models/BattleParty.hpp b/src/Battling/Models/BattleParty.hpp index e9033c9..97d065b 100644 --- a/src/Battling/Models/BattleParty.hpp +++ b/src/Battling/Models/BattleParty.hpp @@ -8,7 +8,7 @@ namespace CreatureLib::Battling { class BattleParty { - CreatureParty* _party; + ArbUt::BorrowedPtr _party; ArbUt::List _responsibleIndices; public: @@ -17,7 +17,7 @@ namespace CreatureLib::Battling { AssertNotNull(_party) } - inline CreatureParty* GetParty() const { return _party; } + inline const ArbUt::BorrowedPtr& GetParty() const { return _party; } inline const ArbUt::List& GetResponsibleIndices() const { return _responsibleIndices; } inline bool IsResponsibleForIndex(const CreatureIndex& index) const { @@ -27,7 +27,7 @@ namespace CreatureLib::Battling { bool IsResponsibleForIndex(uint8_t side, uint8_t index) const; inline bool HasCreaturesNotInField() const { - auto& p = _party->GetParty(); + const auto& p = _party->GetParty(); for (const auto& creature : p) { if (creature == nullptr) continue;