-fixed stack-overflow error
This commit is contained in:
parent
1396d0bf85
commit
9824b587fb
3 changed files with 38 additions and 15 deletions
|
|
@ -1331,8 +1331,8 @@ export class EntityManager
|
|||
ThreadData* data = &threads[thread_id];
|
||||
uint num = cast(uint) del_ids.length;
|
||||
data.change_entities_list.add(0);
|
||||
data.change_entities_list.add((cast(ubyte*)&entity_id)[0 .. 8]);
|
||||
data.change_entities_list.add((cast(ubyte*)&num)[0 .. 4]);
|
||||
data.change_entities_list.add((cast(ubyte*)&entity_id)[0 .. EntityID.sizeof]);
|
||||
data.change_entities_list.add((cast(ubyte*)&num)[0 .. uint.sizeof]);
|
||||
data.change_entities_list.add(cast(ubyte[]) del_ids);
|
||||
}
|
||||
|
||||
|
|
@ -1646,9 +1646,9 @@ export class EntityManager
|
|||
pointers[i] = ∁
|
||||
}*/
|
||||
ThreadData* data = &threads[thread_id];
|
||||
data.change_entities_list.add(1);
|
||||
data.change_entities_list.add((cast(ubyte*)&entity_id)[0 .. 8]);
|
||||
data.change_entities_list.add((cast(ubyte*)&num)[0 .. 4]);
|
||||
data.change_entities_list.add(cast(ubyte)1u);
|
||||
data.change_entities_list.add((cast(ubyte*)&entity_id)[0 .. EntityID.sizeof]);
|
||||
data.change_entities_list.add((cast(ubyte*)&num)[0 .. uint.sizeof]);
|
||||
data.change_entities_list.add(cast(ubyte[]) new_ids);
|
||||
static foreach (i, comp; comps)
|
||||
{
|
||||
|
|
@ -1903,6 +1903,7 @@ export class EntityManager
|
|||
{
|
||||
uint index = 0;
|
||||
uint len = cast(uint) thread.change_entities_list.length;
|
||||
void*[32] pointers;// = (cast(void**) alloca(num * (void*).sizeof))[0 .. num];
|
||||
while (index < len)
|
||||
{
|
||||
if (!thread.change_entities_list[index++])
|
||||
|
|
@ -1911,8 +1912,8 @@ export class EntityManager
|
|||
index += EntityID.sizeof;
|
||||
uint num = *cast(uint*)&thread.change_entities_list[index];
|
||||
index += uint.sizeof;
|
||||
ushort[] ids = (cast(ushort*) alloca(num * ushort.sizeof))[0 .. num];
|
||||
ids[0 .. $] = (cast(ushort*)&thread.change_entities_list[index])[0 .. num];
|
||||
ushort[] ids;// = (cast(ushort*) alloca(num * ushort.sizeof))[0 .. num];
|
||||
ids = (cast(ushort*)&thread.change_entities_list[index])[0 .. num];
|
||||
index += ushort.sizeof * num;
|
||||
__removeComponents(id, ids);
|
||||
}
|
||||
|
|
@ -1922,16 +1923,16 @@ export class EntityManager
|
|||
index += EntityID.sizeof;
|
||||
uint num = *cast(uint*)&thread.change_entities_list[index];
|
||||
index += uint.sizeof;
|
||||
ushort[] ids = (cast(ushort*) alloca(num * ushort.sizeof))[0 .. num];
|
||||
ids[0 .. $] = (cast(ushort*)&thread.change_entities_list[index])[0 .. num];
|
||||
ushort[] ids;// = (cast(ushort*) alloca(num * ushort.sizeof))[0 .. num];
|
||||
ids = (cast(ushort*)&thread.change_entities_list[index])[0 .. num];
|
||||
index += ushort.sizeof * num;
|
||||
void*[] pointers = (cast(void**) alloca(num * (void*).sizeof))[0 .. num];
|
||||
//void*[] pointers = (cast(void**) alloca(num * (void*).sizeof))[0 .. num];
|
||||
foreach (i; 0 .. num)
|
||||
{
|
||||
pointers[i] = &thread.change_entities_list[index];
|
||||
index += components[ids[i]].size;
|
||||
}
|
||||
__addComponents(id, ids, pointers);
|
||||
__addComponents(id, ids, pointers[0..num]);
|
||||
}
|
||||
}
|
||||
thread.change_entities_list.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue