Implements ConstString in several core places in the library, improving performance.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-02-27 18:23:23 +01:00
parent 1d3a8da99e
commit 412e0a4d63
17 changed files with 161 additions and 148 deletions

View File

@@ -1,6 +1,7 @@
#ifndef CREATURELIB_ATTACKDATA_HPP
#define CREATURELIB_ATTACKDATA_HPP
#include <Arbutils/ConstString.hpp>
#include <string>
#include <unordered_set>
#include "AttackCategory.hpp"
@@ -17,11 +18,12 @@ namespace CreatureLib::Library {
uint8_t _baseUsages;
AttackTarget _target;
int8_t _priority;
std::unordered_set<std::string> _flags;
std::unordered_set<Arbutils::CaseInsensitiveConstString> _flags;
public:
AttackData(std::string name, uint8_t type, AttackCategory category, uint8_t power, uint8_t accuracy,
uint8_t baseUsage, AttackTarget target, int8_t priority, std::unordered_set<std::string> flags);
uint8_t baseUsage, AttackTarget target, int8_t priority,
std::unordered_set<Arbutils::CaseInsensitiveConstString> flags);
virtual ~AttackData() = default;
inline const std::string& GetName() const { return _name; }
@@ -33,7 +35,7 @@ namespace CreatureLib::Library {
inline AttackTarget GetTarget() const { return _target; }
inline int8_t GetPriority() const { return _priority; }
bool HasFlag(const std::string& key) const;
bool HasFlag(const Arbutils::CaseInsensitiveConstString& key) const;
};
}