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){};
|
||||
|
||||
void Add(Script* script) {
|
||||
size_t v;
|
||||
if (_lookup.TryGet(script->GetName(), v)) {
|
||||
_scripts[v]->Stack();
|
||||
auto v = _lookup.TryGet(script->GetName());
|
||||
if (v.has_value()) {
|
||||
_scripts[v.value()]->Stack();
|
||||
delete script;
|
||||
return;
|
||||
}
|
||||
|
@ -32,9 +32,9 @@ namespace CreatureLib::Battling {
|
|||
}
|
||||
|
||||
std::optional<ArbUt::BorrowedPtr<Script>> Get(uint32_t keyHash) const noexcept {
|
||||
size_t v;
|
||||
if (_lookup.TryGet(keyHash, v)) {
|
||||
return _scripts[v];
|
||||
auto v = _lookup.TryGet(keyHash);
|
||||
if (v.has_value()) {
|
||||
return _scripts[v.value()];
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ namespace CreatureLib::Battling {
|
|||
void Remove(const ArbUt::BasicStringView& key) { Remove(key.GetHash()); }
|
||||
|
||||
void Remove(uint32_t keyHash) {
|
||||
size_t v;
|
||||
if (_lookup.TryGet(keyHash, v)) {
|
||||
auto script = _scripts[v];
|
||||
auto v = _lookup.TryGet(keyHash);
|
||||
if (v.has_value()) {
|
||||
auto script = _scripts[v.value()];
|
||||
script->OnRemove();
|
||||
_scripts.Remove(v);
|
||||
_scripts.Remove(v.value());
|
||||
_lookup.Remove(keyHash);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue