Overhaul memory model to new Arbutils memory.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -45,14 +45,14 @@ namespace CreatureLib::Battling {
|
||||
}
|
||||
inline bool HasNext() { return _index < _size; }
|
||||
|
||||
ArbUt::BorrowedPtr<Script> GetNextNotNull() {
|
||||
std::optional<ArbUt::BorrowedPtr<Script>> GetNextNotNull() {
|
||||
while (HasNext()) {
|
||||
auto s = GetNext();
|
||||
if (s != nullptr) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
ArbUt::BorrowedPtr<Script> GetNext() {
|
||||
|
||||
@@ -27,14 +27,16 @@ namespace CreatureLib::Battling {
|
||||
_lookup.Insert(script->GetName(), _scripts.Count() - 1);
|
||||
}
|
||||
|
||||
ArbUt::BorrowedPtr<Script> Get(const ArbUt::BasicStringView& key) const { return Get(key.GetHash()); }
|
||||
std::optional<ArbUt::BorrowedPtr<Script>> Get(const ArbUt::BasicStringView& key) const {
|
||||
return Get(key.GetHash());
|
||||
}
|
||||
|
||||
ArbUt::BorrowedPtr<Script> Get(uint32_t keyHash) const noexcept {
|
||||
std::optional<ArbUt::BorrowedPtr<Script>> Get(uint32_t keyHash) const noexcept {
|
||||
size_t v;
|
||||
if (_lookup.TryGet(keyHash, v)) {
|
||||
return _scripts[v];
|
||||
}
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
void Remove(const ArbUt::BasicStringView& key) { Remove(key.GetHash()); }
|
||||
|
||||
Reference in New Issue
Block a user