EntityWrapper::Parent helper function

This commit is contained in:
2016-01-21 10:29:48 +01:00
parent 4aa9100c69
commit 5e70d6eef6
2 changed files with 7 additions and 1 deletions
+1
View File
@@ -24,6 +24,7 @@ struct EntityWrapper
static const EntityWrapper Invalid;
bool HasComponent(const std::string& componentName);
EntityWrapper Parent();
bool Valid();
ComponentWrapper operator[](const char* componentName);
+6 -1
View File
@@ -8,6 +8,11 @@ bool EntityWrapper::HasComponent(const std::string& componentName)
return World->HasComponent(ID, componentName);
}
EntityWrapper EntityWrapper::Parent()
{
return EntityWrapper(World, World->GetParent(ID));
}
bool EntityWrapper::Valid()
{
if (this->World == nullptr) {
@@ -38,7 +43,7 @@ ComponentWrapper EntityWrapper::operator[](const char* componentName)
bool EntityWrapper::operator==(const EntityWrapper& e) const
{
return (this->World == e.World) && (this->ID == e.ID);
return (this->ID == e.ID) && (this->World == e.World);
}
bool EntityWrapper::operator!=(const EntityWrapper& e) const