Fix crash with multiple RevealsShrouds targeting dead frozen actor.

This commit is contained in:
Paul Chote
2016-11-21 22:32:04 +00:00
parent e337048a97
commit 1506a3c26f

View File

@@ -91,8 +91,11 @@ namespace OpenRA.Mods.Common
if (move != null) if (move != null)
{ {
// Move within sight range of the frozen actor // Move within sight range of the frozen actor
var sight = self.TraitOrDefault<RevealsShroud>(); var range = self.TraitsImplementing<RevealsShroud>()
var range = sight != null ? sight.Range : WDist.FromCells(2); .Where(s => !s.IsTraitDisabled)
.Select(s => s.Range)
.Append(WDist.FromCells(2))
.Max();
self.QueueActivity(move.MoveWithinRange(Target.FromPos(frozen.CenterPosition), range)); self.QueueActivity(move.MoveWithinRange(Target.FromPos(frozen.CenterPosition), range));
} }