-support for 'length' parameter in EntitiesData (for convenience)
This commit is contained in:
parent
0e13fafefd
commit
125c9e7d40
3 changed files with 24 additions and 5 deletions
|
|
@ -78,11 +78,17 @@ class EntityManager
|
|||
{
|
||||
static if (isFunction!(__traits(getMember, Sys.EntitiesData, member)))
|
||||
static assert(0, "EntitiesData can't have any function!");
|
||||
else static if(member == "length")
|
||||
{
|
||||
static assert(isIntegral!(typeof(__traits(getMember,Sys.EntitiesData, member))),"EntitiesData 'length' member must be integral type.");
|
||||
static assert(typeof(__traits(getMember,Sys.EntitiesData, member)).sizeof > 1,"EntitiesData 'length' member can't be byte or ubyte.");
|
||||
}
|
||||
else static if (!(isArray!(typeof(__traits(getMember,
|
||||
Sys.EntitiesData, member)))))
|
||||
static assert(0, "EntitiesData members should be arrays of elements!");
|
||||
else static if (is(typeof(__traits(getMember, Sys.EntitiesData,
|
||||
member)) == Entity[]))
|
||||
member)) == Entity[]) || is(typeof(__traits(getMember,
|
||||
Sys.EntitiesData, member)) == const(Entity)[]))
|
||||
{
|
||||
//ret ~= "const string entities_name = \"" ~ member ~ "\";";
|
||||
}
|
||||
|
|
@ -124,6 +130,10 @@ class EntityManager
|
|||
Sys.EntitiesData, member)) == const(Entity)[]))
|
||||
{
|
||||
//ret ~= "const string entities_name = \"" ~ member ~ "\";";
|
||||
}
|
||||
else static if(member == "length")
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -198,6 +208,11 @@ class EntityManager
|
|||
ret ~= "input_data." ~ member
|
||||
~ " = (cast(Entity*) block.dataBegin())[0 .. block.entities_count];";
|
||||
}
|
||||
else if(member == "length")
|
||||
{
|
||||
ret ~= "input_data." ~ member
|
||||
~ " = block.entities_count;";
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
|
|
@ -306,8 +321,8 @@ class EntityManager
|
|||
}
|
||||
else
|
||||
{
|
||||
string name = Mallocator.instance.makeArray(Sys.stringof);
|
||||
systems_map.add(name, cast(ushort) systems.length);
|
||||
system.name = Mallocator.instance.makeArray(Sys.stringof);
|
||||
systems_map.add(system.name, cast(ushort) systems.length);
|
||||
|
||||
systems.add(system);
|
||||
|
||||
|
|
@ -1240,7 +1255,7 @@ class EntityManager
|
|||
Vector!ubyte change_entities_list;
|
||||
|
||||
HashMap!(ushort[], EntityInfo*) entities_infos;
|
||||
HashMap!(string, ushort) systems_map;
|
||||
HashMap!(const (char)[], ushort) systems_map;
|
||||
HashMap!(string, ushort) components_map;
|
||||
HashMap!(string, ushort) events_map;
|
||||
Vector!System systems;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue