From 8f26b4e92b941512f93afb7fce5d14885f6e3d57 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Mon, 24 Jul 2017 16:37:46 +0200 Subject: [PATCH] Fix Mobile not sanitizing target location of Move orders --- OpenRA.Mods.Common/Traits/Mobile.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index de3d639ab8..3134b5043a 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -626,7 +626,9 @@ namespace OpenRA.Mods.Common.Traits { if (order.OrderString == "Move") { - if (!Info.MoveIntoShroud && !self.Owner.Shroud.IsExplored(order.TargetLocation)) + var loc = self.World.Map.Clamp(order.TargetLocation); + + if (!Info.MoveIntoShroud && !self.Owner.Shroud.IsExplored(loc)) return; if (!order.Queued) @@ -634,8 +636,8 @@ namespace OpenRA.Mods.Common.Traits TicksBeforePathing = AverageTicksBeforePathing + self.World.SharedRandom.Next(-SpreadTicksBeforePathing, SpreadTicksBeforePathing); - self.SetTargetLine(Target.FromCell(self.World, order.TargetLocation), Color.Green); - self.QueueActivity(order.Queued, new Move(self, order.TargetLocation, WDist.FromCells(8), null, true)); + self.SetTargetLine(Target.FromCell(self.World, loc), Color.Green); + self.QueueActivity(order.Queued, new Move(self, loc, WDist.FromCells(8), null, true)); } if (order.OrderString == "Stop")