From 04ed2de2c3140064b6f45d0c480c3a9befaa7d48 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Fri, 23 Oct 2015 16:45:47 +0200 Subject: [PATCH] saviours --- src/game/Game/LifebuoySystem.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/game/Game/LifebuoySystem.cpp b/src/game/Game/LifebuoySystem.cpp index 86ac22b..3192464 100644 --- a/src/game/Game/LifebuoySystem.cpp +++ b/src/game/Game/LifebuoySystem.cpp @@ -49,6 +49,11 @@ void dd::Systems::LifebuoySystem::Update(double dt) auto transformComponent = m_World->GetComponent(it->Entity); auto lifebuoyComponent = m_World->GetComponent(it->Entity); + if (!m_World->ValidEntity(it->Entity)){ + m_Lifebuoys.erase(it++); + } + + if (transformComponent->Position.y < m_DownEdge) { m_World->RemoveEntity(it->Entity); m_Lifebuoys.erase(it++);