From 318f496bf9ddf20b35638e3acd52ab109a3e03a1 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 8 Oct 2010 19:03:01 +1300 Subject: [PATCH] #202 fixed --- OpenRA.Game/Selection.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Selection.cs b/OpenRA.Game/Selection.cs index cc861ca6bf..7c99a6de2f 100644 --- a/OpenRA.Game/Selection.cs +++ b/OpenRA.Game/Selection.cs @@ -42,7 +42,7 @@ namespace OpenRA else actors = (isCombine ? oldSelection.Union(newSelection) : newSelection).ToList(); - var voicedUnit = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.HasVoice()); + var voicedUnit = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.IsInWorld && a.HasVoice()); if (voicedUnit != null) Sound.PlayVoice("Select", voicedUnit, voicedUnit.Owner.Country.Race); @@ -56,6 +56,10 @@ namespace OpenRA public void Tick(World world) { actors.RemoveAll(a => !a.IsInWorld); + + foreach (var cg in controlGroups.Values) + cg.RemoveAll(a => a.Destroyed); // note: NOT `!a.IsInWorld`, since that would remove things + // that are in transports. } Cache> controlGroups = new Cache>(_ => new List());