Fixed bug with addComponents template
-deprecated Comonent.ref_ function -remover Comonent.ref_ usage from addComponents template -updated dub.json
This commit is contained in:
parent
54b210346d
commit
85e1f8a76e
5 changed files with 28 additions and 44 deletions
|
|
@ -2424,29 +2424,11 @@ export struct EntityManager
|
|||
void addComponents(Components...)(const EntityID entity_id, Components comps) nothrow @nogc
|
||||
{
|
||||
const uint num = Components.length;
|
||||
/*ushort[num] new_ids;
|
||||
|
||||
static foreach (i, comp; Components)
|
||||
{
|
||||
new_ids[i] = comp.component_id;
|
||||
}
|
||||
|
||||
ThreadData* data = &threads[threadID];
|
||||
data.changeEntitiesList.add(cast(ubyte) 1u);
|
||||
data.changeEntitiesList.add((cast(ubyte*)&entity_id)[0 .. EntityID.sizeof]);
|
||||
data.changeEntitiesList.add((cast(ubyte*)&num)[0 .. uint.sizeof]);
|
||||
data.changeEntitiesList.add(cast(ubyte[]) new_ids);
|
||||
static foreach (i, comp; comps)
|
||||
{
|
||||
data.changeEntitiesList.add((cast(ubyte*)&comp)[0 .. comp.sizeof]);
|
||||
}*/
|
||||
|
||||
//__addComponents(entity_id, new_ids, pointers);
|
||||
|
||||
ComponentRef[num] _comps;
|
||||
static foreach (i, comp; comps)
|
||||
{
|
||||
_comps[i] = comp.ref_;
|
||||
_comps[i] = ComponentRef(&comp, becsID!(typeof(comp)));
|
||||
}
|
||||
addComponents(entity_id, _comps);
|
||||
|
||||
|
|
@ -2469,11 +2451,6 @@ export struct EntityManager
|
|||
data.changeEntitiesList.add(
|
||||
(cast(ubyte*) ref_.ptr)[0 .. components[ref_.component_id].size]);
|
||||
}
|
||||
/*data.changeEntitiesList.add(cast(ubyte[]) new_ids);
|
||||
static foreach (i, comp; comps)
|
||||
{
|
||||
data.changeEntitiesList.add((cast(ubyte*)&comp)[0 .. comp.sizeof]);
|
||||
}*/
|
||||
}
|
||||
|
||||
/************************************************************************************************************************
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue