Tweaks and fixes for AttackData, added C interface.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-02 15:38:18 +01:00
parent 81ae0e8454
commit 461da76f59
3 changed files with 43 additions and 3 deletions

View File

@@ -5,10 +5,13 @@ CreatureLib::Library::AttackData::AttackData(const ConstString& name, uint8_t ty
CreatureLib::Library::AttackCategory category, uint8_t power,
uint8_t accuracy, uint8_t baseUsage,
CreatureLib::Library::AttackTarget target, int8_t priority,
std::unordered_set<Arbutils::CaseInsensitiveConstString> flags)
std::unordered_set<uint32_t> flags)
: _name(std::move(name)), _type(type), _category(category), _basePower(power), _accuracy(accuracy),
_baseUsages(baseUsage), _target(target), _priority(priority), _flags(std::move(flags)) {}
bool CreatureLib::Library::AttackData::HasFlag(const ConstString& key) const {
return this->_flags.find(key) != this->_flags.end();
}
bool CreatureLib::Library::AttackData::HasFlag(uint32_t key) const {
return this->_flags.find(key) != this->_flags.end();
}

View File

@@ -20,11 +20,11 @@ namespace CreatureLib::Library {
uint8_t _baseUsages;
AttackTarget _target;
int8_t _priority;
std::unordered_set<ConstString> _flags;
std::unordered_set<uint32_t> _flags;
public:
AttackData(const ConstString& name, uint8_t type, AttackCategory category, uint8_t power, uint8_t accuracy,
uint8_t baseUsage, AttackTarget target, int8_t priority, std::unordered_set<ConstString> flags);
uint8_t baseUsage, AttackTarget target, int8_t priority, std::unordered_set<uint32_t> flags);
virtual ~AttackData() = default;
inline const ConstString& GetName() const { return _name; }
@@ -37,6 +37,7 @@ namespace CreatureLib::Library {
inline int8_t GetPriority() const { return _priority; }
bool HasFlag(const ConstString& key) const;
bool HasFlag(uint32_t keyHash) const;
};
}