1
0
forked from 0ad/0ad

Detect when units aren't in the world and hide their selection rings. Based on patch by dvangennip. Refs #1365.

This was SVN commit r12239.
This commit is contained in:
Deiz 2012-07-30 04:45:33 +00:00
parent 9e59f496f3
commit 4264166acf

View File

@ -67,7 +67,7 @@ public:
: m_DebugBoundingBoxOverlay(NULL), m_DebugSelectionBoxOverlay(NULL),
m_BuildingOverlay(NULL), m_UnitOverlay(NULL),
m_FadeBaselineAlpha(0.f), m_FadeDeltaAlpha(0.f), m_FadeProgress(0.f),
m_Selected(false), m_Cached(false)
m_Selected(false), m_Cached(false), m_IsInWorld(false)
{
m_Color = CColor(0, 0, 0, m_FadeBaselineAlpha);
}
@ -231,6 +231,8 @@ private:
SOverlayLine* m_DebugBoundingBoxOverlay;
SOverlayLine* m_DebugSelectionBoxOverlay;
// Whether the entity is in the world.
bool m_IsInWorld;
// Whether the entity is only selectable in Atlas editor
bool m_EditorOnly;
// Whether the selection overlay is always visible
@ -315,6 +317,8 @@ void CCmpSelectable::HandleMessage(const CMessage& msg, bool UNUSED(global))
// fall-through
case MT_PositionChanged:
{
const CMessagePositionChanged& msgData = static_cast<const CMessagePositionChanged&> (msg);
m_IsInWorld = msgData.inWorld;
InvalidateStaticOverlay();
break;
}
@ -521,7 +525,7 @@ void CCmpSelectable::UpdateDynamicOverlay(float frameOffset)
void CCmpSelectable::RenderSubmit(SceneCollector& collector)
{
// don't render selection overlay if it's not gonna be visible
if (m_Color.a > 0)
if (m_Color.a > 0 && m_IsInWorld)
{
if (!m_Cached)
{