Basic update, multithreading emplate support, fixed

-Added possibility to add entity form template + components to replace template data
-basic tests for new functionality
-small performance improvement for events
-added ComponentRef structure which contain data pointer and component ID
-now events are called before entities removing
This commit is contained in:
Mergul 2020-05-24 21:57:48 +02:00
parent 3d98b0ee5e
commit 15cd57dbcb
6 changed files with 137 additions and 20 deletions

View file

@ -40,10 +40,9 @@ package struct EventManager
if(block is null)
{
event_block_alloc_mutex.lock();
scope (exit)
event_block_alloc_mutex.unlock();
block = cast(EventBlock*) allocator.getBlock();
event_block_alloc_mutex.unlock();
*block = EventBlock();
data.first_blocks[block_id] = block;
data.blocks[block_id] = block;
@ -52,10 +51,9 @@ package struct EventManager
if(block.count >= data.max_events)
{
event_block_alloc_mutex.lock();
scope (exit)
event_block_alloc_mutex.unlock();
EventBlock* new_block = cast(EventBlock*) allocator.getBlock();
event_block_alloc_mutex.unlock();
*new_block = EventBlock();
block.next = new_block;
block = new_block;