-changed naming style to match whole project

This commit is contained in:
Mergul 2019-04-06 18:07:08 +00:00
parent b0760228b1
commit 63d5839225

View file

@ -524,13 +524,13 @@ class EntityManager
}
static void allocateSystemComponents(ComponentsIndices componentsInfo)(ref System system)
static void allocateSystemComponents(ComponentsIndices components_info)(ref System system)
{
size_t req = componentsInfo.req.length;
size_t opt = componentsInfo.optional.length;
size_t excluded = componentsInfo.excluded.length;
size_t read_only = componentsInfo.readonly.length;
size_t modified = componentsInfo.mutable.length;
size_t req = components_info.req.length;
size_t opt = components_info.optional.length;
size_t excluded = components_info.excluded.length;
size_t read_only = components_info.readonly.length;
size_t modified = components_info.mutable.length;
if (req > 0)
system.m_components = Mallocator.instance.makeArray!ushort(req);
@ -553,7 +553,7 @@ class EntityManager
static ComponentsIndices getComponentsInfo()
{
ComponentsIndices componentsInfo;
ComponentsIndices components_info;
foreach (member; __traits(allMembers, Sys.EntitiesData))
{
@ -568,57 +568,57 @@ class EntityManager
name = Unqual!(ForeachType!MemberType).stringof;
}
bool isOptional;
bool isExcluded;
bool isReadOnly;
bool is_optional;
bool is_excluded;
bool is_read_only;
// isMutable!( ForeachType!(MemberType) );
if (is(CopyConstness!(ForeachType!(MemberType), int) == const(int)))
{
isReadOnly = true;
is_read_only = true;
}
foreach (att; __traits(getAttributes, __traits(getMember, Sys.EntitiesData, member)))
{
if (att == "optional")
{
isOptional = true;
is_optional = true;
}
else if (att == "excluded")
{
isExcluded = true;
is_excluded = true;
}
if (att == "readonly")
{
isReadOnly = true;
is_read_only = true;
}
}
if (isReadOnly)
if (is_read_only)
{
componentsInfo.readonly ~= name;
components_info.readonly ~= name;
}
else
{
componentsInfo.mutable ~= name;
components_info.mutable ~= name;
}
if (isExcluded)
if (is_excluded)
{
componentsInfo.excluded ~= name;
components_info.excluded ~= name;
}
if (isOptional)
if (is_optional)
{
componentsInfo.optional ~= name;
components_info.optional ~= name;
}
if (isReadOnly)
if (is_read_only)
{
componentsInfo.readonly ~= name;
components_info.readonly ~= name;
}
if (isExcluded == false && isOptional == false)
if (is_excluded == false && is_optional == false)
{ //is Req
componentsInfo.req ~= name;
components_info.req ~= name;
}
assert(!(isOptional && isExcluded),
assert(!(is_optional && is_excluded),
"EntitiesData member can't have both \"@optional\" and \"@excluded\".");
}
@ -630,7 +630,7 @@ class EntityManager
foreach (str; Fields!(Sys.ExcludedComponents))
{
ComponentInfo info;
info.isExcluded = true;
info.is_excluded = true;
info.name = str.stringof;
}
}
@ -639,14 +639,14 @@ class EntityManager
foreach (str; Sys.ExcludedComponents)
{
ComponentInfo info;
info.isExcluded = true;
info.is_excluded = true;
info.name = str;
}
}
}
return componentsInfo;
return components_info;
}
static void genCompList()(ref System system, ref HashMap!(const(char)[], ushort) components_map)
@ -667,34 +667,34 @@ class EntityManager
static assert(0, "EntitiesData members should be arrays of elements!");
}
enum ComponentsIndices componentsInfo = getComponentsInfo();
allocateSystemComponents!(componentsInfo)(system);
enum ComponentsIndices components_info = getComponentsInfo();
allocateSystemComponents!(components_info)(system);
foreach (iii, name; componentsInfo.req)
foreach (iii, name; components_info.req)
{
ushort comp = components_map.get(cast(char[]) name, ushort.max);
assert(comp != ushort.max, "Can't register system \""~Sys.stringof~"\" due to non existing component \""~name~"\".");
system.m_components[iii] = comp;
}
foreach (iii, name; componentsInfo.excluded)
foreach (iii, name; components_info.excluded)
{
ushort comp = components_map.get(cast(char[]) name, ushort.max);
assert(comp != ushort.max, "Can't register system \""~Sys.stringof~"\" due to non existing component \""~name~"\".");
system.m_excluded_components[iii] = comp;
}
foreach (iii, name; componentsInfo.optional)
foreach (iii, name; components_info.optional)
{
ushort comp = components_map.get(cast(char[]) name, ushort.max);
assert(comp != ushort.max, "Can't register system \""~Sys.stringof~"\" due to non existing component \""~name~"\".");
system.m_optional_components[iii] = comp;
}
foreach (iii, name; componentsInfo.readonly)
foreach (iii, name; components_info.readonly)
{
ushort comp = components_map.get(cast(char[]) name, ushort.max);
assert(comp != ushort.max, "Can't register system \""~Sys.stringof~"\" due to non existing component \""~name~"\".");
system.m_read_only_components[iii] = comp;
}
foreach (iii, name; componentsInfo.mutable)
foreach (iii, name; components_info.mutable)
{
ushort comp = components_map.get(cast(char[]) name, ushort.max);
assert(comp != ushort.max, "Can't register system \""~Sys.stringof~"\" due to non existing component \""~name~"\".");