diff --git a/source/ecs/attributes.d b/source/ecs/attributes.d index 3a5ec95..cb49933 100644 --- a/source/ecs/attributes.d +++ b/source/ecs/attributes.d @@ -2,7 +2,7 @@ module ecs.attributes; ///Used to mark optional components for system. enum optional = "optional"; -///Used to mark components excluded from update for system. Enum 'ExcludedComponents' should be used instead of it. -enum excluded = "excluded"; +//Used to mark components excluded from update for system. Enum 'ExcludedComponents' should be used instead of it. +//enum excluded = "excluded"; ///Used to mark readonly components for system. "const" can be used insted. enum readonly = "readonly"; \ No newline at end of file diff --git a/source/ecs/manager.d b/source/ecs/manager.d index 6925aa9..42799aa 100644 --- a/source/ecs/manager.d +++ b/source/ecs/manager.d @@ -349,16 +349,16 @@ class EntityManager } - bool checkExcludedComponentsSomething(Sys)() - { - return __traits(compiles, allSameType!(string, typeof(Sys.ExcludedComponents))) && allSameType!(string, - typeof(Sys.ExcludedComponents)) && isExpressions!(Sys.ExcludedComponents); - } - static ComponentsIndices getComponentsInfo() { ComponentsIndices components_info; + bool checkExcludedComponentsSomething(Sys)() + { + return __traits(compiles, allSameType!(string, typeof(Sys.ExcludedComponents))) && allSameType!(string, + typeof(Sys.ExcludedComponents)) && isExpressions!(Sys.ExcludedComponents); + } + foreach (member; __traits(allMembers, Sys.EntitiesData)) { alias MemberType = typeof(__traits(getMember, Sys.EntitiesData, member)); @@ -375,7 +375,7 @@ class EntityManager } bool is_optional; - bool is_excluded; + //bool is_excluded; bool is_read_only; if (is(CopyConstness!(ForeachType!(MemberType), int) == const(int))) @@ -389,10 +389,10 @@ class EntityManager { is_optional = true; } - else if (att == "excluded") + /*else if (att == "excluded") { is_excluded = true; - } + }*/ if (att == "readonly") { is_read_only = true; @@ -406,10 +406,10 @@ class EntityManager { components_info.mutable ~= CompInfo(member,name); } - if (is_excluded) + /*if (is_excluded) { components_info.excluded ~= CompInfo(member,name); - } + }*/ if (is_optional) { components_info.optional ~= CompInfo(member,name); @@ -418,13 +418,13 @@ class EntityManager { components_info.readonly ~= CompInfo(member,name); } - if (is_excluded == false && is_optional == false) + if (/*is_excluded == false &&*/ is_optional == false) { //is Req components_info.req ~= CompInfo(member,name); } - assert(!(is_optional && is_excluded), - "EntitiesData member can't have both \"@optional\" and \"@excluded\"."); + /*assert(!(is_optional && is_excluded), + "EntitiesData member can't have both \"@optional\" and \"@excluded\".");*/ } @@ -432,21 +432,16 @@ class EntityManager { static if (is(Sys.ExcludedComponents == enum)) { - foreach (str; Fields!(Sys.ExcludedComponents)) + foreach (str; __traits(allMembers, Sys.ExcludedComponents)) { - ComponentInfo info; - info.is_excluded = true; - info.name = str.stringof; + components_info.excluded ~= CompInfo(str,str); } } else static if (checkExcludedComponentsSomething!Sys) { foreach (str; Sys.ExcludedComponents) { - ComponentInfo info; - info.is_excluded = true; - info.name = str; - + components_info.excluded ~= CompInfo(str,str); } } diff --git a/tests/tests.d b/tests/tests.d index bf6fd53..db85ba7 100644 --- a/tests/tests.d +++ b/tests/tests.d @@ -344,14 +344,14 @@ struct TestSystem2 { mixin ECS.System!16; //__gshared ushort system_id; - /*enum ExcludedComponents0 + /*enum ExcludedComponents { TestComp, TestComp4 - } - - alias ExcludedComponents = AliasSeq!("TestComp", "TestComp4"); + }*/ + //alias ExcludedComponents = AliasSeq!("TestComp", "TestComp4"); +/* string ExcludedComponents2;*/ static struct EntitiesData