Make CreateCreature use smart pointers.

This commit is contained in:
Deukhoofd 2020-06-02 17:19:23 +02:00
parent 62583ecb17
commit a5a613ba5c
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 3 additions and 2 deletions

View File

@ -8,7 +8,7 @@
namespace CreatureLib::Battling { namespace CreatureLib::Battling {
class CreateCreature { class CreateCreature {
const BattleLibrary* _library; ArbUt::BorrowedPtr<const BattleLibrary> _library;
ArbUt::CaseInsensitiveConstString _species; ArbUt::CaseInsensitiveConstString _species;
ArbUt::CaseInsensitiveConstString _variant = "default"_cnc; ArbUt::CaseInsensitiveConstString _variant = "default"_cnc;
uint8_t _level; uint8_t _level;
@ -22,7 +22,8 @@ namespace CreatureLib::Battling {
ArbUt::List<std::tuple<ArbUt::BorrowedPtr<const Library::AttackData>, AttackLearnMethod>> _attacks; ArbUt::List<std::tuple<ArbUt::BorrowedPtr<const Library::AttackData>, AttackLearnMethod>> _attacks;
public: public:
CreateCreature(const BattleLibrary* library, const ArbUt::CaseInsensitiveConstString& species, uint8_t level) CreateCreature(ArbUt::BorrowedPtr<const BattleLibrary> library,
const ArbUt::CaseInsensitiveConstString& species, uint8_t level)
: _library(library), _species(species), _level(level), _attacks(library->GetSettings()->GetMaximalMoves()) { : _library(library), _species(species), _level(level), _attacks(library->GetSettings()->GetMaximalMoves()) {
} }