Added section ordering for systems runtime
This commit is contained in:
parent
34b929c4e7
commit
6cd249dc5b
4 changed files with 117 additions and 8 deletions
|
@ -11,6 +11,8 @@ class PagedSparseSet
|
|||
private List<Entity> _packed = new .() ~ delete _;
|
||||
private UList _packedEntities ~ delete _;
|
||||
|
||||
private function void(void* data) _deallocationFunction = null;
|
||||
|
||||
public this(int_cosize size)
|
||||
{
|
||||
_packedEntities = new .(size);
|
||||
|
@ -29,12 +31,15 @@ class PagedSparseSet
|
|||
_sparse[e.Index/PageSize][e.Index % PageSize] = (.)_packed.Count-1;
|
||||
}
|
||||
|
||||
public bool Remove(Entity e)
|
||||
public bool Remove(Entity e, bool cleanup = false)
|
||||
{
|
||||
EnsurePage(e.Index/PageSize);
|
||||
if(_sparse[e.Index/PageSize] == null)
|
||||
return false;
|
||||
|
||||
if(_deallocationFunction != null && !cleanup)
|
||||
_deallocationFunction(_packedEntities[(.)(_sparse[e.Index/PageSize][e.Index % PageSize].Index)]);
|
||||
|
||||
let toRm = _packed[_sparse[e.Index/PageSize][e.Index % PageSize].Index];
|
||||
let b = _packed.Back;
|
||||
_packed[_sparse[e.Index/PageSize][e.Index % PageSize].Index] = b;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue