fixes #37: phantom units

This commit is contained in:
Chris Forbes
2009-10-23 21:45:28 +13:00
parent 7f1e881c47
commit 5082d9abdd
3 changed files with 9 additions and 6 deletions

View File

@@ -71,6 +71,9 @@ namespace OpenRa.Game
{
var uog = orderGenerator as UnitOrderGenerator;
if (uog != null)
uog.selection.RemoveAll(a => a.IsDead);
if (uog != null && uog.selection.Count > 0
&& uog.selection.Any(a => a.traits.Contains<Traits.Mobile>())
&& uog.selection.All( a => a.Owner == Game.LocalPlayer ))

View File

@@ -77,9 +77,9 @@ namespace OpenRa.Game.Graphics
DrawSelectionBox(u, Color.Yellow, false);
}
var selection = Game.controller.orderGenerator as UnitOrderGenerator;
if (selection != null)
foreach( var a in Game.world.Actors.Intersect(selection.selection) )
var uog = Game.controller.orderGenerator as UnitOrderGenerator;
if (uog != null)
foreach( var a in uog.selection )
DrawSelectionBox(a, Color.White, true);
lineRenderer.Flush();

View File

@@ -22,7 +22,7 @@ namespace OpenRa.Game
public void AddFrameEndTask( Action<World> a ) { frameEndActions.Add( a ); }
public event Action<Actor> ActorAdded = _ => { };
public event Action<Actor> ActorRemoved = _ => { };
public event Action<Actor> ActorRemoved = a => { a.Health = 0; }; /* make sure everyone sees it as dead */
public void ResetTimer()
{