Make learned attacks on Creature be optional.
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
2020-12-12 15:10:18 +01:00
parent 29d6632472
commit 2055837980
2 changed files with 10 additions and 10 deletions

View File

@@ -51,7 +51,7 @@ namespace CreatureLib::Battling {
ArbUt::StringView _overridenTalentName;
std::unordered_set<ArbUt::BorrowedPtr<Creature>> _seenOpponents;
ArbUt::UniquePtrList<LearnedAttack> _attacks;
ArbUt::OptionalUniquePtrList<LearnedAttack> _attacks;
bool _allowedExperienceGain;
std::unique_ptr<Script> _status = nullptr;
@@ -138,7 +138,7 @@ namespace CreatureLib::Battling {
void RemoveVolatileScript(Script* script);
bool HasVolatileScript(const ArbUt::BasicStringView& name) const;
const ArbUt::UniquePtrList<LearnedAttack>& GetAttacks() noexcept { return _attacks; }
const ArbUt::OptionalUniquePtrList<LearnedAttack>& GetAttacks() noexcept { return _attacks; }
bool HasAttack(const ArbUt::StringView& name) {
for (auto& a : _attacks) {
if (a == nullptr)