fix: Adds multis to map iterators, fixes searching empty nested containers (#1581)
### Summary
Eliminates `IPooledEnumerable<BaseMulti>` and `eable.Free()` from `Map` for multis. This drastically simplifies code that iterates in range, for example:
```cs
foreach (var m in m.GetMultisInRange(5))
{
}
```
The code above no longer requires an eable and calling `Free()`.
### Bug Fixes
- [X] Fixes an issue with searching through nested empty containers.
This commit is contained in:
parent
1f04a13f67
commit
ca3df9cfa7
12 changed files with 960 additions and 860 deletions
|
|
@ -161,14 +161,17 @@ public partial class Container
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool SetNextContainer()
|
||||
{
|
||||
if (!_containers.TryDequeue(out var c))
|
||||
while (_containers.TryDequeue(out var c))
|
||||
{
|
||||
return false;
|
||||
_items = CollectionsMarshal.AsSpan(c.m_Items);
|
||||
_index = 0;
|
||||
if (SetNextItem())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
_items = CollectionsMarshal.AsSpan(c.m_Items);
|
||||
_index = 0;
|
||||
return SetNextItem();
|
||||
return false;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue