From a5c89c2edc03d4e70ad8f83f028e46f7752d9689 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 1 Dec 2018 12:00:06 +0000 Subject: [PATCH] Remove Order.TargetLocation from AttackMove. --- OpenRA.Mods.Common/Traits/AttackMove.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/AttackMove.cs b/OpenRA.Mods.Common/Traits/AttackMove.cs index 0906d4648c..d0dd8c0580 100644 --- a/OpenRA.Mods.Common/Traits/AttackMove.cs +++ b/OpenRA.Mods.Common/Traits/AttackMove.cs @@ -85,8 +85,12 @@ namespace OpenRA.Mods.Common.Traits string IOrderVoice.VoicePhraseForOrder(Actor self, Order order) { - if (!Info.MoveIntoShroud && !self.Owner.Shroud.IsExplored(order.TargetLocation)) - return null; + if (!Info.MoveIntoShroud && order.Target.Type != TargetType.Invalid) + { + var cell = self.World.Map.CellContaining(order.Target.CenterPosition); + if (!self.Owner.Shroud.IsExplored(cell)) + return null; + } if (order.OrderString == "AttackMove" || order.OrderString == "AssaultMove") return Info.Voice; @@ -116,10 +120,11 @@ namespace OpenRA.Mods.Common.Traits if (!order.Queued) self.CancelActivity(); - if (!Info.MoveIntoShroud && !self.Owner.Shroud.IsExplored(order.TargetLocation)) + var cell = self.World.Map.Clamp(self.World.Map.CellContaining(order.Target.CenterPosition)); + if (!Info.MoveIntoShroud && !self.Owner.Shroud.IsExplored(cell)) return; - TargetLocation = move.NearestMoveableCell(order.TargetLocation); + TargetLocation = move.NearestMoveableCell(cell); self.SetTargetLine(Target.FromCell(self.World, TargetLocation.Value), Color.Red); Activate(self, order.OrderString == "AssaultMove"); }