1
0
forked from 0ad/0ad

Restore highlighting of units on hover.

Optimise overlay code a bit.

This was SVN commit r8253.
This commit is contained in:
Ykkrosh 2010-10-03 16:48:52 +00:00
parent a47227daaa
commit aa32677784
2 changed files with 11 additions and 12 deletions

View File

@ -471,20 +471,12 @@ function handleInputAfterGui(ev)
switch (ev.type)
{
case "mousemotion":
// Highlight the first hovered entities, if it's not a unit
// Highlight the first hovered entity (if any)
var ents = Engine.PickEntitiesAtPoint(ev.x, ev.y);
if (ents.length == 0)
{
g_Selection.setHighlightList([]);
}
if (ents.length)
g_Selection.setHighlightList([ents[0]]);
else
{
var entState = GetEntityState(ents[0]);
if (entState && !isUnit(entState))
g_Selection.setHighlightList([ents[0]]);
else
g_Selection.setHighlightList([]);
}
g_Selection.setHighlightList([]);
return false;

View File

@ -115,6 +115,13 @@ public:
void Interpolate(float UNUSED(frameTime), float frameOffset)
{
// Skip all the following computations if we have no sprites
if (m_Sprites.empty())
{
m_Enabled = false;
return;
}
// Disable rendering of the unit if it has no position
CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), GetEntityId());
if (cmpPosition.null() || !cmpPosition->IsInWorld())