From c7dc2371432763b561efb5d1615f388f9cd0f923 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 1 Dec 2018 12:01:40 +0000 Subject: [PATCH] Remove Order.TargetLocation from Mobile. --- OpenRA.Mods.Common/Traits/Mobile.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index a94afc7f5f..0c664c894f 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -699,16 +699,15 @@ namespace OpenRA.Mods.Common.Traits { if (order.OrderString == "Move") { - var loc = self.World.Map.Clamp(order.TargetLocation); - - if (!Info.LocomotorInfo.MoveIntoShroud && !self.Owner.Shroud.IsExplored(loc)) + var cell = self.World.Map.Clamp(this.self.World.Map.CellContaining(order.Target.CenterPosition)); + if (!Info.LocomotorInfo.MoveIntoShroud && !self.Owner.Shroud.IsExplored(cell)) return; if (!order.Queued) self.CancelActivity(); - self.SetTargetLine(Target.FromCell(self.World, loc), Color.Green); - self.QueueActivity(order.Queued, new Move(self, loc, WDist.FromCells(8), null, true)); + self.SetTargetLine(Target.FromCell(self.World, cell), Color.Green); + self.QueueActivity(order.Queued, new Move(self, cell, WDist.FromCells(8), null, true)); } if (order.OrderString == "Stop") @@ -720,12 +719,17 @@ namespace OpenRA.Mods.Common.Traits string IOrderVoice.VoicePhraseForOrder(Actor self, Order order) { - if (!Info.LocomotorInfo.MoveIntoShroud && !self.Owner.Shroud.IsExplored(order.TargetLocation)) - return null; - switch (order.OrderString) { case "Move": + if (!Info.LocomotorInfo.MoveIntoShroud && order.Target.Type != TargetType.Invalid) + { + var cell = self.World.Map.CellContaining(order.Target.CenterPosition); + if (!self.Owner.Shroud.IsExplored(cell)) + return null; + } + + return Info.Voice; case "Scatter": case "Stop": return Info.Voice;