-fixed issue with optional components in systems
This commit is contained in:
parent
8cb5d6ce62
commit
9511e1936e
1 changed files with 19 additions and 5 deletions
|
|
@ -457,8 +457,7 @@ class EntityManager
|
|||
ushort[] deltas = (cast(ushort*) alloca(num * ushort.sizeof))[0 .. num];
|
||||
uint delta_id = 0;
|
||||
|
||||
ushort[] cmp_array = system.m_components;
|
||||
add_deltas: foreach (id; cmp_array)
|
||||
foreach (id; system.m_components)
|
||||
{
|
||||
deltas[delta_id] = ushort.max;
|
||||
foreach (i2, id2; entity.components)
|
||||
|
|
@ -478,11 +477,26 @@ class EntityManager
|
|||
}
|
||||
if (deltas is null)
|
||||
return;
|
||||
if (cmp_array.ptr == system.m_components.ptr)
|
||||
|
||||
foreach (id; system.m_optional_components)
|
||||
{
|
||||
cmp_array = system.m_optional_components;
|
||||
goto add_deltas;
|
||||
deltas[delta_id] = ushort.max;
|
||||
foreach (i2, id2; entity.components)
|
||||
{
|
||||
if (id2 == id)
|
||||
{
|
||||
deltas[delta_id] = entity.deltas[id2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*if (deltas[delta_id] == ushort.max)
|
||||
{
|
||||
deltas = null;
|
||||
break;
|
||||
}*/
|
||||
delta_id++;
|
||||
}
|
||||
|
||||
|
||||
call_data.deltas = Mallocator.instance.makeArray(deltas); //Mallocator.instance.makeArray!ushort(system.m_components.length);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue