-fixed EntityTemplate.getComponent()

-fxied issue with components string in systems HashMap
This commit is contained in:
Mergul 2018-09-27 22:45:23 +02:00
parent c915b1a8c7
commit c0ac19b6f9
2 changed files with 22 additions and 5 deletions

View file

@ -329,12 +329,19 @@ class EntityManager
if (sys_id < systems.length)
{
system.enable();
/*if (systems[sys_id].m_destroy)
systems[sys_id].m_destroy(systems[sys_id].m_system_pointer);*/
if (system.m_create)
system.m_create(system.m_system_pointer);
systems[sys_id] = system;
Sys.system_id = sys_id;
}
else
{
systems_map.add(Sys.stringof, cast(ushort) systems.length);
string name = Mallocator.instance.makeArray(Sys.stringof);
systems_map.add(name, cast(ushort) systems.length);
systems.add(system);
@ -394,12 +401,14 @@ class EntityManager
if (comp_id < components.length)
{
Comp.component_id = comp_id;
components[comp_id] = info;
}
else
{
components.add(info);
Comp.component_id = cast(ushort)(components.length - 1);
components_map.add(Comp.stringof, cast(ushort)(components.length - 1));
string name = Mallocator.instance.makeArray(Comp.stringof);
components_map.add(name, cast(ushort)(components.length - 1));
}
}