Fixed unittests and betterC compilation (after adding fullyQualifiedName instead of simple stringof)

-added new trait to get full name of structure (witho module and package, not tested on more nested packages)
-some small improvements (like adding const to function which need it)
This commit is contained in:
Mergul 2020-07-08 22:04:13 +02:00
parent b0b64b965f
commit a0efa4e67d
5 changed files with 53 additions and 15 deletions

View file

@ -42,7 +42,7 @@ struct Entity
return cast(T*)(cast(void*)block + info.deltas[T.component_id] + block.entityIndex(&this) * T.sizeof);
}
bool hasComponent(ushort component_id)
bool hasComponent(ushort component_id) const
{
EntityManager.EntitiesBlock* block = gEM.getMetaData(&this);
EntityManager.EntityInfo* info = block.type_info;
@ -72,9 +72,9 @@ struct EntityMeta
return cast(T*)(cast(void*)block + block.type_info.deltas[T.component_id] + index * T.sizeof);
}
bool hasComponent(ushort component_id)
bool hasComponent(ushort component_id) const
{
EntityManager.EntityInfo* info = block.type_info;
const EntityManager.EntityInfo* info = block.type_info;
if (component_id >= info.deltas.length || info.deltas[component_id] == 0)return false;
return true;
}