Mostly bugfix update + empty components support and remove EntityID from Event structure
-empty components now take no memory, so flag components is now far better -added test for critical bug -fixed critical bug with adding/removing entities form inside events -fixed small bug with TestRunner -improve basic tests -fixed betterC compilation on DMD -remove EntityID form Event structure -added "return" attribute to some functions -moved some code from Tempalte side to actual implementation -fixed bug with EntityTemplate copying -commented out some possibliy unused code -use code formatter
This commit is contained in:
parent
15cd57dbcb
commit
6929f5a748
16 changed files with 988 additions and 544 deletions
|
|
@ -39,11 +39,7 @@ struct Entity
|
|||
if (T.component_id >= info.deltas.length || info.deltas[T.component_id] == 0)
|
||||
return null;
|
||||
|
||||
static if (EntityID.sizeof == 8)
|
||||
uint ind = cast(uint)((cast(void*)&this - block.dataBegin()) >> 3);
|
||||
else
|
||||
uint ind = cast(uint)((cast(void*)&this - block.dataBegin()) / EntityID.sizeof());
|
||||
return cast(T*)(cast(void*)block + info.deltas[T.component_id] + ind * T.sizeof);
|
||||
return cast(T*)(cast(void*)block + info.deltas[T.component_id] + block.entityIndex(&this) * T.sizeof);
|
||||
}
|
||||
|
||||
bool hasComponent(ushort component_id)
|
||||
|
|
@ -58,10 +54,7 @@ struct Entity
|
|||
{
|
||||
EntityMeta meta;
|
||||
meta.block = gEM.getMetaData(&this);
|
||||
static if (EntityID.sizeof == 8)
|
||||
meta.index = cast(ushort)((cast(void*)&this - meta.block.dataBegin()) >> 3);
|
||||
else
|
||||
meta.index = cast(ushort)((cast(void*)&this - meta.block.dataBegin()) / EntityID.sizeof());
|
||||
meta.index = meta.block.entityIndex(&this);
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue