-fixed critical bug with onAdd callback
This commit is contained in:
parent
4ac80d7025
commit
c64d621f0e
1 changed files with 7 additions and 4 deletions
|
|
@ -1941,16 +1941,19 @@ class EntityManager
|
|||
foreach (block; thread.blocks_to_update)
|
||||
{
|
||||
EntityInfo* info = block.type_info;
|
||||
if(info.add_listeners)
|
||||
{
|
||||
callAddEntityListeners(info,block,block.entities_count,block.entities_count+block.added_count);
|
||||
}
|
||||
ushort entities_count = block.entities_count;
|
||||
block.entities_count += block.added_count;
|
||||
if (block.entities_count > block.type_info.max_entities)
|
||||
{
|
||||
block.entities_count = block.type_info.max_entities;
|
||||
}
|
||||
block.added_count.atomicStore(cast(ushort) 0);
|
||||
|
||||
if(info.add_listeners)
|
||||
{
|
||||
callAddEntityListeners(info,block,entities_count,block.entities_count);
|
||||
}
|
||||
|
||||
}
|
||||
thread.blocks_to_update.clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue