diff --git a/source/ecs/manager.d b/source/ecs/manager.d index d13e81c..25548a7 100644 --- a/source/ecs/manager.d +++ b/source/ecs/manager.d @@ -55,8 +55,15 @@ class EntityManager Sys* s = cast(Sys*) data.system.system_pointer; EntitiesBlock* block = data.info.first_block; - void* data_pointer = block.dataBegin(); - mixin(genCall()); + while(block !is null) + { + void* data_pointer = block.dataBegin(); + foreach(i; 0..block.entities_count){ + mixin(genCall()); + data_pointer+=data.info.size; + } + block=block.next_block; + } } } @@ -186,7 +193,8 @@ class EntityManager EntitiesBlock* block=tmpl.info.first_with_free_space;//tmpl.info.first_block; // find block with enought space - while(1){ + while(1) + { if(block is null) { block = cast(EntitiesBlock*) AlignedMallocator.instance.alignedAllocate(4096,4096); diff --git a/tests/tests.d b/tests/tests.d index 0541386..fc1ffbb 100644 --- a/tests/tests.d +++ b/tests/tests.d @@ -62,13 +62,13 @@ unittest assert( cast(ptrdiff_t)&test % TestComp.alignof == 0 ); assert( cast(ptrdiff_t)&test2 % TestComp2.alignof == 0 ); import std.stdio; - writeln("Jakis tekst! ",test.b); + //writeln("Jakis tekst! ",test.b); test.a+=1000; test.b+=2000; - writeln("Jakis tekst! ",test.b); + //writeln("Jakis tekst! ",test.b); test2.b += 2; test2.a = 1; - writeln("Jakis tekst! ",test2.b); + //writeln("Jakis tekst! ",test2.b); } void handleEvent(Event event, ref TestComp comp)