diff --git a/source/ecs/manager.d b/source/ecs/manager.d index 95fd7b0..c315979 100644 --- a/source/ecs/manager.d +++ b/source/ecs/manager.d @@ -302,7 +302,7 @@ class EntityManager return ret; } - static void callUpdate(ref CallData data, void* entity) + static void callUpdate(ref CallData data) { Sys* s = cast(Sys*) data.system.m_system_pointer; @@ -354,6 +354,10 @@ class EntityManager mixin(genCompList()); + if(system.m_components)qsort(system.m_components.ptr, system.m_components.length, ushort.sizeof, &compareUShorts); + if(system.m_optional_components)qsort(system.m_optional_components.ptr, system.m_optional_components.length, ushort.sizeof, &compareUShorts); + if(system.m_absen_components)qsort(system.m_absen_components.ptr, system.m_absen_components.length, ushort.sizeof, &compareUShorts); + ushort sys_id = systems_map.get(Sys.stringof, ushort.max); if (sys_id < systems.length) { @@ -493,7 +497,7 @@ class EntityManager foreach (data; info.callers) { if (data.system.enabled) - (cast(SytemFuncType) data.system.m_update)(data, null); //caller(call_data,null); + (cast(SytemFuncType) data.system.m_update)(data); //caller(call_data,null); } } } @@ -1331,7 +1335,7 @@ class EntityManager EntityManager.EntityInfo* info; } - alias SytemFuncType = void function(ref EntityManager.CallData data, void* entity); + alias SytemFuncType = void function(ref EntityManager.CallData data); //alias sendSelfEvent = instance.event_manager.sendSelfEvent; diff --git a/source/ecs/system.d b/source/ecs/system.d index 38722e4..421321d 100644 --- a/source/ecs/system.d +++ b/source/ecs/system.d @@ -63,8 +63,8 @@ package: ///optional components ushort[] m_optional_components; - //void function(ref EntityManager.CallData data, void* entity) update; - void* m_update; ///workaroud for DMD bug with upper line + void function(ref EntityManager.CallData data) m_update; + //void* m_update; ///workaroud for DMD bug with upper line void function(void* system_pointer) m_enable; void function(void* system_pointer) m_disable; @@ -74,4 +74,7 @@ package: void function(void* system_pointer) m_begin; void function(void* system_pointer) m_end; + + void function(ref EntityManager.CallData data) m_initialize; + void function(ref EntityManager.CallData data) m_deinitilize; }