Add @nogc UDA, fix some small issues, xmake changes

-add @nogc to some functions where it was missing
-fix compilation issue in mallocator
-fix Meson build
-some work on xmake build
This commit is contained in:
Mergul 2023-03-23 22:31:20 +01:00
parent 5e123d96b3
commit 3a3a9e0341
6 changed files with 39 additions and 26 deletions

View file

@ -44,7 +44,7 @@ struct Entity
return cast(T*)getComponent(becsID!T);
}
void* getComponent(ushort component_id) const
void* getComponent(ushort component_id) const nothrow @nogc
{
EntityManager.EntitiesBlock* block = gEntityManager.getMetaData(&this);
EntityManager.EntityInfo* info = block.type_info;
@ -54,7 +54,7 @@ struct Entity
return (cast(void*)block + info.deltas[component_id] + block.entityIndex(&this) * gEntityManager.components[component_id].size);
}
bool hasComponent(ushort component_id) const
bool hasComponent(ushort component_id) const nothrow @nogc
{
EntityManager.EntitiesBlock* block = gEntityManager.getMetaData(&this);
EntityManager.EntityInfo* info = block.type_info;
@ -62,7 +62,7 @@ struct Entity
return true;
}
EntityMeta getMeta() const
EntityMeta getMeta() const nothrow @nogc
{
EntityMeta meta;
meta.block = gEntityManager.getMetaData(&this);
@ -85,7 +85,7 @@ struct EntityMeta
return cast(T*)getComponent(becsID!T);
}
void* getComponent(ushort component_id) const
void* getComponent(ushort component_id) const nothrow @nogc
{
const (EntityManager.EntityInfo)* info = block.type_info;
@ -95,7 +95,7 @@ struct EntityMeta
return (cast(void*)block + info.deltas[component_id] + index * gEntityManager.components[component_id].size);
}
bool hasComponent(ushort component_id) const
bool hasComponent(ushort component_id) const nothrow @nogc
{
const EntityManager.EntityInfo* info = block.type_info;
if (component_id >= info.deltas.length || info.deltas[component_id] == 0)return false;
@ -124,7 +124,7 @@ export struct EntityTemplate
/************************************************************************************************************************
Get specified component. If component doesn't exist function return null. Returned pointer is valid during EntityTemplate lifetime.
*/
T* getComponent(T)() nothrow @nogc
T* getComponent(T)()
{
if(becsID!T >= info.tmpl_deltas.length || info.tmpl_deltas[becsID!T] == ushort.max)return null;
return cast(T*)(entity_data.ptr + info.tmpl_deltas[becsID!T]);