fixes #37: phantom units
This commit is contained in:
@@ -71,6 +71,9 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
var uog = orderGenerator as UnitOrderGenerator;
|
var uog = orderGenerator as UnitOrderGenerator;
|
||||||
|
|
||||||
|
if (uog != null)
|
||||||
|
uog.selection.RemoveAll(a => a.IsDead);
|
||||||
|
|
||||||
if (uog != null && uog.selection.Count > 0
|
if (uog != null && uog.selection.Count > 0
|
||||||
&& uog.selection.Any(a => a.traits.Contains<Traits.Mobile>())
|
&& uog.selection.Any(a => a.traits.Contains<Traits.Mobile>())
|
||||||
&& uog.selection.All( a => a.Owner == Game.LocalPlayer ))
|
&& uog.selection.All( a => a.Owner == Game.LocalPlayer ))
|
||||||
|
|||||||
@@ -77,9 +77,9 @@ namespace OpenRa.Game.Graphics
|
|||||||
DrawSelectionBox(u, Color.Yellow, false);
|
DrawSelectionBox(u, Color.Yellow, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var selection = Game.controller.orderGenerator as UnitOrderGenerator;
|
var uog = Game.controller.orderGenerator as UnitOrderGenerator;
|
||||||
if (selection != null)
|
if (uog != null)
|
||||||
foreach( var a in Game.world.Actors.Intersect(selection.selection) )
|
foreach( var a in uog.selection )
|
||||||
DrawSelectionBox(a, Color.White, true);
|
DrawSelectionBox(a, Color.White, true);
|
||||||
|
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace OpenRa.Game
|
|||||||
int lastTime = Environment.TickCount;
|
int lastTime = Environment.TickCount;
|
||||||
const int timestep = 40;
|
const int timestep = 40;
|
||||||
|
|
||||||
public void Add(Actor a) { actors.Add(a); ActorAdded(a); }
|
public void Add(Actor a) { actors.Add(a); ActorAdded(a); }
|
||||||
public void Remove(Actor a) { actors.Remove(a); ActorRemoved(a); }
|
public void Remove(Actor a) { actors.Remove(a); ActorRemoved(a); }
|
||||||
|
|
||||||
public void Add(IEffect b) { effects.Add(b); }
|
public void Add(IEffect b) { effects.Add(b); }
|
||||||
@@ -21,8 +21,8 @@ namespace OpenRa.Game
|
|||||||
|
|
||||||
public void AddFrameEndTask( Action<World> a ) { frameEndActions.Add( a ); }
|
public void AddFrameEndTask( Action<World> a ) { frameEndActions.Add( a ); }
|
||||||
|
|
||||||
public event Action<Actor> ActorAdded = _ => { };
|
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()
|
public void ResetTimer()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user