-EntityTemplate.getComponent additional data check

-LinearLayout proggress:
 *added alignment to data
 *fixed add/remove component functions
This commit is contained in:
Mergul 2018-09-26 12:50:51 +02:00
parent c18ac54265
commit c915b1a8c7
3 changed files with 63 additions and 38 deletions

View file

@ -45,6 +45,7 @@ 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]);
}