diff --git a/source/simulation2/components/CCmpRallyPointRenderer.cpp b/source/simulation2/components/CCmpRallyPointRenderer.cpp index 64504be57c..dc16628c64 100644 --- a/source/simulation2/components/CCmpRallyPointRenderer.cpp +++ b/source/simulation2/components/CCmpRallyPointRenderer.cpp @@ -80,6 +80,7 @@ public: componentManager.SubscribeToMessageType(MT_RenderSubmit); componentManager.SubscribeToMessageType(MT_OwnershipChanged); componentManager.SubscribeToMessageType(MT_TurnStart); + componentManager.SubscribeToMessageType(MT_Destroy); // TODO: should probably also listen to movement messages (unlikely to happen in-game, but might occur inside atlas) } @@ -239,6 +240,15 @@ public: UpdateOverlayLines(); // check for changes to the SoD and update the overlay lines accordingly } break; + case MT_Destroy: + { + if (m_MarkerEntityId != INVALID_ENTITY) + { + GetSimContext().GetComponentManager().DestroyComponentsSoon(m_MarkerEntityId); + m_MarkerEntityId = INVALID_ENTITY; + } + } + break; } }