Update to latest Arbutils.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
185ec40ba5
commit
3bd39cc035
|
@ -16,9 +16,9 @@ namespace CreatureLib::Battling {
|
||||||
ScriptSet() : _scripts(defaultCapacity), _lookup(defaultCapacity){};
|
ScriptSet() : _scripts(defaultCapacity), _lookup(defaultCapacity){};
|
||||||
|
|
||||||
void Add(Script* script) {
|
void Add(Script* script) {
|
||||||
size_t v;
|
auto v = _lookup.TryGet(script->GetName());
|
||||||
if (_lookup.TryGet(script->GetName(), v)) {
|
if (v.has_value()) {
|
||||||
_scripts[v]->Stack();
|
_scripts[v.value()]->Stack();
|
||||||
delete script;
|
delete script;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ namespace CreatureLib::Battling {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<ArbUt::BorrowedPtr<Script>> Get(uint32_t keyHash) const noexcept {
|
std::optional<ArbUt::BorrowedPtr<Script>> Get(uint32_t keyHash) const noexcept {
|
||||||
size_t v;
|
auto v = _lookup.TryGet(keyHash);
|
||||||
if (_lookup.TryGet(keyHash, v)) {
|
if (v.has_value()) {
|
||||||
return _scripts[v];
|
return _scripts[v.value()];
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -42,11 +42,11 @@ namespace CreatureLib::Battling {
|
||||||
void Remove(const ArbUt::BasicStringView& key) { Remove(key.GetHash()); }
|
void Remove(const ArbUt::BasicStringView& key) { Remove(key.GetHash()); }
|
||||||
|
|
||||||
void Remove(uint32_t keyHash) {
|
void Remove(uint32_t keyHash) {
|
||||||
size_t v;
|
auto v = _lookup.TryGet(keyHash);
|
||||||
if (_lookup.TryGet(keyHash, v)) {
|
if (v.has_value()) {
|
||||||
auto script = _scripts[v];
|
auto script = _scripts[v.value()];
|
||||||
script->OnRemove();
|
script->OnRemove();
|
||||||
_scripts.Remove(v);
|
_scripts.Remove(v.value());
|
||||||
_lookup.Remove(keyHash);
|
_lookup.Remove(keyHash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue