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
|
|
@ -16,10 +16,12 @@ struct SimpleVector
|
|||
///Add element to vector
|
||||
void add(ubyte el) nothrow @nogc
|
||||
{
|
||||
while(used >= data.length)
|
||||
while (used >= data.length)
|
||||
{
|
||||
if(data is null)data = Mallocator.makeArray!ubyte(1024);
|
||||
else data = Mallocator.expandArray(data,data.length);
|
||||
if (data is null)
|
||||
data = Mallocator.makeArray!ubyte(1024);
|
||||
else
|
||||
data = Mallocator.expandArray(data, data.length);
|
||||
}
|
||||
data[used++] = el;
|
||||
}
|
||||
|
|
@ -27,10 +29,12 @@ struct SimpleVector
|
|||
///Add array of elements to vector
|
||||
void add(ubyte[] el) nothrow @nogc
|
||||
{
|
||||
while(used + el.length >= data.length)
|
||||
while (used + el.length >= data.length)
|
||||
{
|
||||
if(data is null)data = Mallocator.makeArray!ubyte(1024);
|
||||
else data = Mallocator.expandArray(data,data.length);
|
||||
if (data is null)
|
||||
data = Mallocator.makeArray!ubyte(1024);
|
||||
else
|
||||
data = Mallocator.expandArray(data, data.length);
|
||||
}
|
||||
memcpy(data.ptr + used, el.ptr, el.length);
|
||||
used += el.length;
|
||||
|
|
@ -44,23 +48,23 @@ struct SimpleVector
|
|||
|
||||
export ref ubyte opIndex(size_t pos) nothrow @nogc
|
||||
{
|
||||
return data[pos];
|
||||
}
|
||||
return data[pos];
|
||||
}
|
||||
|
||||
export ubyte[] opSlice() nothrow @nogc
|
||||
export ubyte[] opSlice() nothrow @nogc
|
||||
{
|
||||
return data[0 .. used];
|
||||
}
|
||||
return data[0 .. used];
|
||||
}
|
||||
|
||||
export ubyte[] opSlice(size_t x, size_t y) nothrow @nogc
|
||||
export ubyte[] opSlice(size_t x, size_t y) nothrow @nogc
|
||||
{
|
||||
return data[x .. y];
|
||||
}
|
||||
return data[x .. y];
|
||||
}
|
||||
|
||||
export size_t opDollar() nothrow @nogc
|
||||
export size_t opDollar() nothrow @nogc
|
||||
{
|
||||
return used;
|
||||
}
|
||||
return used;
|
||||
}
|
||||
|
||||
///set vector length to 0
|
||||
void clear() nothrow @nogc
|
||||
|
|
@ -70,4 +74,4 @@ struct SimpleVector
|
|||
|
||||
ubyte[] data = null;
|
||||
size_t used = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue