-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

@ -45,8 +45,16 @@ export struct EntityTemplate
T* getComponent(T)()
{
if(T.component_id >= info.tmpl_deltas.length)return null;
version(LinearLayout)return cast(T*)(entity_data.ptr + info.tmpl_deltas[T.component_id]);
else return cast(T*)(entity_data.ptr + info.deltas[T.component_id]);
version(LinearLayout)
{
if(T.component_id >= info.tmpl_deltas.length)return null;
return cast(T*)(entity_data.ptr + info.tmpl_deltas[T.component_id]);
}
else
{
if(T.component_id >= info.deltas.length)return null;
return cast(T*)(entity_data.ptr + info.deltas[T.component_id]);
}
}
}