ECS fixes

-fixed bug with addEntityCopy (on create was called for bad entity, and incorrect block was added to update)
-added function to retrieve Component pointer from Entity (not  template function)
-fixed thread_pool bug
This commit is contained in:
Mergul 2020-08-22 11:37:23 +02:00
parent 64dc099e0a
commit 8960423935
3 changed files with 31 additions and 9 deletions

View file

@ -2513,17 +2513,17 @@ export struct EntityManager
{
ushort size = components[comp].size;
if (size != 0)
memcpy(cast(void*) new_block + info.deltas[comp] + size * new_id,
memcpy(cast(void*) new_block + info.deltas[comp] + new_id * size,
cast(void*) block + info.deltas[comp] + size * index, size);
if (components[comp].create_callback)
{
components[comp].create_callback(
cast(void*) block + info.deltas[comp] + new_id * size);
cast(void*) new_block + info.deltas[comp] + new_id * size);
}
}
if (new_index == 1 && info.update_block == block)
if (new_index == 1 && info.update_block == new_block)
threads[threadID].infosToUpdate.add(info);
Entity* new_entity = cast(Entity*) start;