Added EntityWrapper::IsChildOf and made snapshot interpolation and rendering exceptions for player less hacky

This commit is contained in:
2016-01-23 11:44:16 +01:00
parent 31e7340daf
commit db0e67b9bd
7 changed files with 21 additions and 24 deletions
+12
View File
@@ -36,6 +36,18 @@ EntityWrapper EntityWrapper::FirstChildByName(const std::string& name)
return EntityWrapper::Invalid;
}
bool EntityWrapper::IsChildOf(EntityWrapper potentialParent)
{
EntityWrapper entity = *this;
while (entity.Parent().Valid()) {
entity = entity.Parent();
if (entity == potentialParent) {
return true;
}
}
return false;
}
bool EntityWrapper::Valid()
{
if (this->World == nullptr) {