-removed commented code
This commit is contained in:
parent
63d5839225
commit
a93529dad1
1 changed files with 0 additions and 203 deletions
|
|
@ -312,208 +312,6 @@ class EntityManager
|
|||
}
|
||||
}
|
||||
|
||||
/*static string genCompList()()
|
||||
{
|
||||
|
||||
static foreach (member; __traits(allMembers, Sys.EntitiesData))
|
||||
{
|
||||
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!");
|
||||
}
|
||||
|
||||
string ret;
|
||||
|
||||
uint req;
|
||||
uint opt;
|
||||
uint excluded;
|
||||
uint read_only;
|
||||
uint modified;
|
||||
foreach (member; __traits(allMembers, Sys.EntitiesData))
|
||||
{
|
||||
if (member == "length" || is(typeof(__traits(getMember,
|
||||
Sys.EntitiesData, member)) == Entity[]) || is(typeof(__traits(getMember,
|
||||
Sys.EntitiesData, member)) == const(Entity)[]))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
bool has_att = false;
|
||||
bool is_read_only = false;
|
||||
int attribs = 0;
|
||||
if (is(CopyConstness!(ForeachType!(typeof(mixin("Sys.EntitiesData." ~ member))),
|
||||
int) == const(int)))
|
||||
{
|
||||
is_read_only = true;
|
||||
}
|
||||
foreach (att; __traits(getAttributes,
|
||||
__traits(getMember, Sys.EntitiesData, member)))
|
||||
{
|
||||
if (att == "optional")
|
||||
{
|
||||
opt++;
|
||||
attribs++;
|
||||
//break;
|
||||
}
|
||||
else if (att == "excluded")
|
||||
{
|
||||
excluded++;
|
||||
attribs++;
|
||||
//break;
|
||||
}
|
||||
if (att == "readonly")
|
||||
{
|
||||
is_read_only = true;
|
||||
}
|
||||
}
|
||||
assert(attribs <= 1,
|
||||
"EntitiesData member can't have both \"@optional\" and \"@excluded\".");
|
||||
if (!attribs)
|
||||
req++;
|
||||
if (is_read_only)
|
||||
read_only++;
|
||||
else
|
||||
modified++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static if (__traits(hasMember, Sys, "ExcludedComponents"))
|
||||
{
|
||||
static if (is(Sys.ExcludedComponents == enum))
|
||||
{
|
||||
excluded += (Fields!(Sys.ExcludedComponents)).length; //static assert(0,"Enum ExcludedComponents are not implemented yet.");
|
||||
}
|
||||
else static if (__traits(compiles, allSameType!(string, typeof(Sys.ExcludedComponents)))
|
||||
&& allSameType!(string, typeof(Sys.ExcludedComponents))
|
||||
&& isExpressions!(Sys.ExcludedComponents))
|
||||
{
|
||||
excluded += Sys.ExcludedComponents.length;
|
||||
}
|
||||
}
|
||||
|
||||
if (req > 0)
|
||||
ret ~= "system.m_components = Mallocator.instance.makeArray!ushort("
|
||||
~ req.to!string ~ ");";
|
||||
if (opt > 0)
|
||||
ret ~= "system.m_optional_components = Mallocator.instance.makeArray!ushort("
|
||||
~ opt.to!string ~ ");";
|
||||
if (excluded > 0)
|
||||
ret ~= "system.m_excluded_components = Mallocator.instance.makeArray!ushort("
|
||||
~ excluded.to!string ~ ");";
|
||||
if (read_only > 0)
|
||||
ret ~= "system.m_read_only_components = Mallocator.instance.makeArray!ushort("
|
||||
~ read_only.to!string ~ ");";
|
||||
if (modified > 0)
|
||||
ret ~= "system.m_modified_components = Mallocator.instance.makeArray!ushort("
|
||||
~ modified.to!string ~ ");";
|
||||
ret ~= "ushort comp;"; //uint opt = 0;uint req = 0;uint excluded = 0;";
|
||||
|
||||
opt = 0;
|
||||
req = 0;
|
||||
excluded = 0;
|
||||
read_only = 0;
|
||||
modified = 0;
|
||||
|
||||
static if (__traits(hasMember, Sys, "ExcludedComponents"))
|
||||
{
|
||||
static if (is(Sys.ExcludedComponents == enum))
|
||||
{
|
||||
//static assert(0,"Enum ExcludedComponents are not implemented yet.");
|
||||
foreach (str; Fields!(Sys.ExcludedComponents))
|
||||
ret ~= "system.m_excluded_components[" ~ (excluded++)
|
||||
.to!string ~ "] = components_map.get(\""
|
||||
~ str.stringof ~ "\", ushort.max);";
|
||||
}
|
||||
else static if (__traits(compiles, allSameType!(string, typeof(Sys.ExcludedComponents)))
|
||||
&& allSameType!(string, typeof(Sys.ExcludedComponents))
|
||||
&& isExpressions!(Sys.ExcludedComponents))
|
||||
{
|
||||
foreach (str; Sys.ExcludedComponents)
|
||||
ret ~= "system.m_excluded_components[" ~ (excluded++)
|
||||
.to!string ~ "] = components_map.get(\"" ~ str ~ "\", ushort.max);";
|
||||
}
|
||||
}
|
||||
|
||||
foreach (member; __traits(allMembers, Sys.EntitiesData))
|
||||
{
|
||||
if (member == "length" || is(typeof(__traits(getMember,
|
||||
Sys.EntitiesData, member)) == Entity[]) || is(typeof(__traits(getMember,
|
||||
Sys.EntitiesData, member)) == const(Entity)[]))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
ret ~= "{comp = components_map.get(Unqual!(ForeachType!(typeof(
|
||||
Sys.EntitiesData." ~ member ~ ")))
|
||||
.stringof, ushort.max);\n
|
||||
if(comp == ushort.max)assert(0,\"Can't register system \\\""
|
||||
~ Sys.stringof
|
||||
~ "\\\" due to non existing component \" ~ ForeachType!(typeof(
|
||||
Sys.EntitiesData."
|
||||
~ member ~ "))
|
||||
.stringof
|
||||
~ \".\");";
|
||||
|
||||
bool is_read_only = false;
|
||||
bool has_att = false;
|
||||
if (is(CopyConstness!(ForeachType!(typeof(mixin("Sys.EntitiesData." ~ member))),
|
||||
int) == const(int)))
|
||||
{
|
||||
is_read_only = true;
|
||||
}
|
||||
foreach (att; __traits(getAttributes,
|
||||
__traits(getMember, Sys.EntitiesData, member)))
|
||||
{
|
||||
if (att == "optional")
|
||||
{
|
||||
ret ~= "system.m_optional_components[" ~ (opt++)
|
||||
.to!string ~ "] = comp;";
|
||||
has_att = true;
|
||||
//break;
|
||||
}
|
||||
else if (att == "excluded")
|
||||
{
|
||||
ret ~= "system.m_excluded_components[" ~ (excluded++)
|
||||
.to!string ~ "] = comp;";
|
||||
has_att = true;
|
||||
//break;
|
||||
}
|
||||
if (att == "readonly")
|
||||
{
|
||||
is_read_only = true;
|
||||
}
|
||||
}
|
||||
if (!has_att)
|
||||
{
|
||||
ret ~= "system.m_components[" ~ (req++).to!string ~ "] = comp;";
|
||||
}
|
||||
if (is_read_only)
|
||||
ret ~= "system.m_read_only_components[" ~ (read_only++)
|
||||
.to!string ~ "] = comp;";
|
||||
else
|
||||
ret ~= "system.m_modified_components[" ~ (modified++)
|
||||
.to!string ~ "] = comp;";
|
||||
ret ~= "}";
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}*/
|
||||
|
||||
static struct ComponentsIndices
|
||||
{
|
||||
string[] readonly;
|
||||
|
|
@ -572,7 +370,6 @@ class EntityManager
|
|||
bool is_excluded;
|
||||
bool is_read_only;
|
||||
|
||||
// isMutable!( ForeachType!(MemberType) );
|
||||
if (is(CopyConstness!(ForeachType!(MemberType), int) == const(int)))
|
||||
{
|
||||
is_read_only = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue