Make Effect field in Item OptionalUniquePtr.
continuous-integration/drone/push Build is passing Details

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
Deukhoofd 2021-03-07 12:39:15 +01:00
parent 26c36f8ece
commit 715da74320
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 6 additions and 4 deletions

View File

@ -7,7 +7,7 @@ namespace CreatureLib::Library {
BattleItemCategory _battleCategory; BattleItemCategory _battleCategory;
int32_t _price; int32_t _price;
std::unique_ptr<const SecondaryEffect> _effect = nullptr; ArbUt::OptionalUniquePtr<const SecondaryEffect> _effect = nullptr;
std::unordered_set<uint32_t> _flags; std::unordered_set<uint32_t> _flags;
public: public:
@ -20,7 +20,7 @@ namespace CreatureLib::Library {
inline ItemCategory GetCategory() const noexcept { return _category; } inline ItemCategory GetCategory() const noexcept { return _category; }
inline BattleItemCategory GetBattleCategory() const noexcept { return _battleCategory; } inline BattleItemCategory GetBattleCategory() const noexcept { return _battleCategory; }
inline int32_t GetPrice() const noexcept { return _price; } inline int32_t GetPrice() const noexcept { return _price; }
inline const std::unique_ptr<const SecondaryEffect>& GetEffect() const noexcept { return _effect; } inline const ArbUt::OptionalUniquePtr<const SecondaryEffect>& GetEffect() const noexcept { return _effect; }
inline bool HasFlag(const ArbUt::BasicStringView& flag) const noexcept { return this->_flags.contains(flag); } inline bool HasFlag(const ArbUt::BasicStringView& flag) const noexcept { return this->_flags.contains(flag); }
inline bool HasFlag(uint32_t flag) const noexcept { return this->_flags.contains(flag); } inline bool HasFlag(uint32_t flag) const noexcept { return this->_flags.contains(flag); }
@ -34,7 +34,9 @@ namespace CreatureLib::Library {
ItemCategory Item::GetCategory() const noexcept { return _impl->GetCategory(); } ItemCategory Item::GetCategory() const noexcept { return _impl->GetCategory(); }
BattleItemCategory Item::GetBattleCategory() const noexcept { return _impl->GetBattleCategory(); } BattleItemCategory Item::GetBattleCategory() const noexcept { return _impl->GetBattleCategory(); }
int32_t Item::GetPrice() const noexcept { return _impl->GetPrice(); } int32_t Item::GetPrice() const noexcept { return _impl->GetPrice(); }
const std::unique_ptr<const SecondaryEffect>& Item::GetEffect() const noexcept { return _impl->GetEffect(); } const ArbUt::OptionalUniquePtr<const SecondaryEffect>& Item::GetEffect() const noexcept {
return _impl->GetEffect();
}
bool Item::HasFlag(const ArbUt::BasicStringView& flag) const noexcept { return _impl->HasFlag(flag); } bool Item::HasFlag(const ArbUt::BasicStringView& flag) const noexcept { return _impl->HasFlag(flag); }
bool Item::HasFlag(uint32_t flag) const noexcept { return _impl->HasFlag(flag); } bool Item::HasFlag(uint32_t flag) const noexcept { return _impl->HasFlag(flag); }

View File

@ -23,7 +23,7 @@ namespace CreatureLib::Library {
BattleItemCategory GetBattleCategory() const noexcept; BattleItemCategory GetBattleCategory() const noexcept;
int32_t GetPrice() const noexcept; int32_t GetPrice() const noexcept;
const std::unique_ptr<const SecondaryEffect>& GetEffect() const noexcept; const ArbUt::OptionalUniquePtr<const SecondaryEffect>& GetEffect() const noexcept;
bool HasFlag(const ArbUt::BasicStringView& flag) const noexcept; bool HasFlag(const ArbUt::BasicStringView& flag) const noexcept;
bool HasFlag(uint32_t flag) const noexcept; bool HasFlag(uint32_t flag) const noexcept;
}; };