Merge remote-tracking branch 'origin/Networking' into Networking

This commit is contained in:
Jocke
2016-01-23 16:41:42 +01:00
11 changed files with 25 additions and 29 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) {
+3 -20
View File
@@ -48,14 +48,9 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
}
EntityWrapper entity(m_World, modelComponent.EntityID);
bool isLocalPlayer = entity == m_LocalPlayer;
while (entity.Parent().Valid()) {
entity = entity.Parent();
if (entity == m_LocalPlayer) {
isLocalPlayer = true;
}
}
if (isLocalPlayer) {
// Don't render the local player
if (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer)) {
continue;
}
@@ -149,18 +144,6 @@ void RenderSystem::fillText(std::list<std::shared_ptr<RenderJob>>& jobs, World*
continue;
}
EntityWrapper entity(m_World, textComponent.EntityID);
bool isLocalPlayer = entity == m_LocalPlayer;
while (entity.Parent().Valid()) {
entity = entity.Parent();
if (entity == m_LocalPlayer) {
isLocalPlayer = true;
}
}
if (isLocalPlayer) {
continue;
}
Font* font;
try {
font = ResourceManager::Load<Font>(resource);