-sorting components ids in systems
-changed callUpdate() prototype
This commit is contained in:
parent
437c672478
commit
2004909642
2 changed files with 12 additions and 5 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue