-change ecsID to becsID

-change component_id/system_id to becsID in demos
This commit is contained in:
Mergul 2021-02-27 17:25:13 +01:00
parent a926b79223
commit a6d92cb21b
17 changed files with 296 additions and 272 deletions

View file

@ -408,7 +408,7 @@ export struct EntityManager
~ "\" due to non existing event \"" ~ EventName ~ "\".");
callers[i].callback = cast(void*)&callEventHandler!(EventParamType);
callers[i].id = ecsID!EventParamType;
callers[i].id = becsID!EventParamType;
i++;
}
}
@ -1125,7 +1125,7 @@ export struct EntityManager
system.m_priority = priority;
//(cast(Sys*) system.m_system_pointer).__ecsInitialize();
//system.jobs = (cast(Sys*) system.m_system_pointer)._ecs_jobs;
static if(__traits(hasMember, Sys ,"__ecs_jobs_count"))system.jobs = Mallocator.makeArray!(Job)(Sys.__ecs_jobs_count);
static if(__traits(hasMember, Sys ,"__becs_jobs_count"))system.jobs = Mallocator.makeArray!(Job)(Sys.__becs_jobs_count);
else system.jobs = Mallocator.makeArray!(Job)(32);
static if (OnUpdateOverloadNum != -1)
@ -1194,7 +1194,7 @@ export struct EntityManager
systems[$ - 1].enable();
}
ecsID!Sys = system.id;
becsID!Sys = system.id;
}
/************************************************************************************************************************
@ -1212,9 +1212,9 @@ export struct EntityManager
*/
Sys* getSystem(Sys)() nothrow @nogc
{
if (ecsID!Sys >= systems.length)
if (becsID!Sys >= systems.length)
return null;
return cast(Sys*) systems[ecsID!Sys].m_system_pointer;
return cast(Sys*) systems[becsID!Sys].m_system_pointer;
}
export ushort registerPass(const(char)[] name)
@ -1283,7 +1283,7 @@ export struct EntityManager
ushort comp_id = components_map.get(cast(char[]) ComponentName, ushort.max);
if (comp_id < components.length)
{
ecsID!Comp = comp_id;
becsID!Comp = comp_id;
if (components[comp_id].init_data)
Mallocator.dispose(components[comp_id].init_data);
components[comp_id] = info;
@ -1291,7 +1291,7 @@ export struct EntityManager
else
{
components.add(info);
ecsID!Comp = cast(ushort)(components.length - 1);
becsID!Comp = cast(ushort)(components.length - 1);
char[] name = Mallocator.makeArray(cast(char[]) ComponentName);
components_map.add(name, cast(ushort)(components.length - 1));
}
@ -1324,12 +1324,12 @@ export struct EntityManager
ushort event_id = events_map.get(fullName!Ev, ushort.max);
if (event_id < events.length)
{
ecsID!Ev = event_id;
becsID!Ev = event_id;
}
else
{
events.add(info);
ecsID!Ev = cast(ushort)(events.length - 1);
becsID!Ev = cast(ushort)(events.length - 1);
// events_map.add(Ev.stringof, cast(ushort)(events.length - 1));
events_map.add(fullName!Ev, cast(ushort)(events.length - 1));
}
@ -1350,7 +1350,7 @@ export struct EntityManager
// "Function must match system update function."); FIXME: It's lead to crash on android build
// static assert(__traits(hasMember, Sys, "system_id"), "Sys must be system type.");
System* system = getSystem(ecsID!Sys);
System* system = getSystem(becsID!Sys);
assert(system != null,
"System must be registered in EntityManager before any funcion can be called.");
if (!system.m_any_system_caller)
@ -2256,7 +2256,7 @@ export struct EntityManager
ushort[num] del_ids;
static foreach (i, comp; Components)
{
del_ids[i] = ecsID!comp;
del_ids[i] = becsID!comp;
}
removeComponents(entity_id, del_ids);