-renamed callbacks:

*onAdd -> onAddEntity
*onRemove -> onRemoveEntity
*update -> onUpdate
This commit is contained in:
Mergul 2019-03-28 18:01:43 +01:00
parent d118adc028
commit 7a33e4f94f
3 changed files with 30 additions and 30 deletions

View file

@ -95,7 +95,7 @@ class EntityManager
{
if (system.m_update is null)
{
if (system.m_entity_added || system.m_entity_removed)
if (system.m_add_entity || system.m_remove_entity)
{
foreach (info; &entities_infos.byValue)
{
@ -570,7 +570,7 @@ class EntityManager
string genParamsChecking()()
{
string ret;
foreach (func; __traits(getOverloads, Sys, "update"))
foreach (func; __traits(getOverloads, Sys, "onUpdate"))
{
if ((Parameters!(func)).length == 1)
ret ~= "\"" ~ (fullyQualifiedName!(Sys.EntitiesData)) ~ "\" == \"" ~ (
@ -650,7 +650,7 @@ class EntityManager
mixin(genFillInputData());
}
static if (hasMember!(Sys, "update") && (mixin(genParamsChecking())))
static if (hasMember!(Sys, "onUpdate") && (mixin(genParamsChecking())))
{
static void callUpdate(ref CallData data)
{
@ -691,7 +691,7 @@ class EntityManager
fillInputData(input_data, info, block, offset, entities_count, system);
//mixin(genFillInputData());
s.update(input_data);
s.onUpdate(input_data);
block = block.next_block;
offset = 0;
@ -759,8 +759,8 @@ class EntityManager
mixin(catchFunc!(bool)("m_begin", "onBegin"));
mixin(catchFunc("m_end", "onEnd"));
mixin(catchEntityFunc("m_entity_added", "onAdd"));
mixin(catchEntityFunc("m_entity_removed", "onRemove"));
mixin(catchEntityFunc("m_add_entity", "onAddEntity"));
mixin(catchEntityFunc("m_remove_entity", "onRemoveEntity"));
system.m_system_pointer = cast(void*) Mallocator.instance.make!Sys;
system.m_priority = priority;
@ -1210,10 +1210,10 @@ class EntityManager
foreach (i, ref system; systems)
{
//if(system.m_entity_added || system.m_entity_removed)info.systems[system.id] = true;
//if(system.m_add_entity || system.m_remove_entity)info.systems[system.id] = true;
if (system.m_update is null)
{
if (system.m_entity_added || system.m_entity_removed)
if (system.m_add_entity || system.m_remove_entity)
connectListenerToEntityInfo(*info, cast(uint) i);
continue;
}
@ -1253,7 +1253,7 @@ class EntityManager
{
System* system = &systems[i];
//onAddEntity listener
if (system.m_entity_added)
if (system.m_add_entity)
{
//find listener position by priority
int j;
@ -1272,7 +1272,7 @@ class EntityManager
tmp_add[j] = cast(ushort) i;
}
//onRemoveEntity listener
if (system.m_entity_removed)
if (system.m_remove_entity)
{
//find listener position by priority
int j;
@ -2002,7 +2002,7 @@ class EntityManager
data.block = block;
data.begin = begin;
data.end = end;
(cast(void function(ref ListenerCallData) nothrow @nogc) system.m_entity_added)(data);
(cast(void function(ref ListenerCallData) nothrow @nogc) system.m_add_entity)(data);
}
private void callRemoveEntityListeners(EntityInfo* info, EntitiesBlock* block, int begin,
@ -2023,7 +2023,7 @@ class EntityManager
data.block = block;
data.begin = begin;
data.end = end;
(cast(void function(ref ListenerCallData) nothrow @nogc) system.m_entity_removed)(data);
(cast(void function(ref ListenerCallData) nothrow @nogc) system.m_remove_entity)(data);
}
private void updateBlocks()