Add ConstString to several other places where context isn't changed much during runtime.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-02-28 19:23:24 +01:00
parent 469fcfe280
commit 5a05a2f4d3
17 changed files with 73 additions and 85 deletions

View File

@@ -8,7 +8,7 @@
namespace CreatureLib::Battling {
class ScriptSet {
std::vector<Script*> _scripts;
std::unordered_map<std::string, size_t> _lookup;
std::unordered_map<ConstString, size_t> _lookup;
public:
~ScriptSet() {
@@ -28,7 +28,7 @@ namespace CreatureLib::Battling {
_lookup.insert({script->GetName(), _scripts.size() - 1});
}
Script* Get(const std::string& key) const {
Script* Get(const ConstString& key) const {
auto f = _lookup.find(key);
if (f != _lookup.end()) {
return _scripts[f->second];
@@ -36,7 +36,7 @@ namespace CreatureLib::Battling {
return nullptr;
}
void Remove(const std::string& key) {
void Remove(const ConstString& key) {
auto find = _lookup.find(key);
if (find != _lookup.end()) {
auto script = _scripts[find->second];
@@ -55,7 +55,7 @@ namespace CreatureLib::Battling {
_lookup.clear();
}
bool Has(const std::string& key) const {
bool Has(const ConstString& key) const {
auto find = _lookup.find(key);
return find != _lookup.end();
}