-fixed events bug with calls for unsupported systems
-now empty systems can't handle events and listeners
This commit is contained in:
parent
d6b53425dd
commit
546b73c567
3 changed files with 71 additions and 14 deletions
|
|
@ -164,14 +164,16 @@ export struct EntityManager
|
|||
|
||||
foreach (ref system; systems)
|
||||
{
|
||||
if (system.m_empty == true)
|
||||
if (system.m_empty)
|
||||
{
|
||||
addSystemCaller(system.id);
|
||||
if (system.m_update)
|
||||
addSystemCaller(system.id);
|
||||
continue;
|
||||
}
|
||||
if (system.m_update is null)
|
||||
{
|
||||
if (system.m_add_entity || system.m_remove_entity || system.m_change_entity)
|
||||
if (system.m_add_entity || system.m_remove_entity
|
||||
|| system.m_change_entity || system.m_event_callers.length)
|
||||
{
|
||||
foreach (info; &entities_infos.byValue)
|
||||
{
|
||||
|
|
@ -181,7 +183,7 @@ export struct EntityManager
|
|||
continue;
|
||||
}
|
||||
|
||||
bool added = false;
|
||||
/*bool added = false;
|
||||
foreach (i, caller; passes[system.m_pass].system_callers)
|
||||
{
|
||||
if (systems[caller.system_id].priority > system.priority)
|
||||
|
|
@ -202,7 +204,8 @@ export struct EntityManager
|
|||
sys_caller.job_group.caller = sys_caller;
|
||||
system.m_any_system_caller = sys_caller;
|
||||
passes[system.m_pass].system_callers.add(sys_caller);
|
||||
}
|
||||
}*/
|
||||
addSystemCaller(system.id);
|
||||
|
||||
foreach (info; &entities_infos.byValue)
|
||||
{
|
||||
|
|
@ -739,6 +742,9 @@ export struct EntityManager
|
|||
enum OnUpdateOverloadNum = -1;
|
||||
//enum HasOnUpdate = (hasMember!(Sys, "onUpdate") && checkOnUpdateParams());
|
||||
|
||||
static if (components_info.req.length == 0 && components_info.optional.length == 0)
|
||||
system.m_empty = true;
|
||||
|
||||
static if (OnUpdateOverloadNum != -1)
|
||||
{
|
||||
static if (components_info.req.length != 0 || components_info.optional.length != 0)
|
||||
|
|
@ -819,8 +825,6 @@ export struct EntityManager
|
|||
(cast(typeof(&__traits(getOverloads, s,
|
||||
"onUpdate")[OnUpdateOverloadNum])) data.update_delegate)(input_data);
|
||||
}
|
||||
|
||||
system.m_empty = true;
|
||||
}
|
||||
|
||||
system.m_update = &callUpdate;
|
||||
|
|
@ -1454,9 +1458,12 @@ export struct EntityManager
|
|||
|
||||
foreach (i, ref system; systems)
|
||||
{
|
||||
if (system.m_empty)
|
||||
continue;
|
||||
if (system.m_update is null)
|
||||
{
|
||||
if (system.m_add_entity || system.m_remove_entity || system.m_change_entity)
|
||||
if (system.m_add_entity || system.m_remove_entity
|
||||
|| system.m_change_entity || system.m_event_callers.length)
|
||||
connectListenerToEntityInfo(*info, cast(uint) i);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue