diff --git a/OpenRA.Game/Orders/UnitOrderGenerator.cs b/OpenRA.Game/Orders/UnitOrderGenerator.cs index 537b6cc03f..2fdb69e477 100644 --- a/OpenRA.Game/Orders/UnitOrderGenerator.cs +++ b/OpenRA.Game/Orders/UnitOrderGenerator.cs @@ -96,7 +96,7 @@ namespace OpenRA.Orders public string GetCursor( World world, int2 xy, MouseInput mi ) { - bool useSelect = false; + bool useSelect = false; var custom = world.WorldActor.TraitOrDefault(); if (custom != null) @@ -129,19 +129,10 @@ namespace OpenRA.Orders if (self.Owner != self.World.LocalPlayer) return null; - if (!self.World.Map.IsInMap(xy.X, xy.Y)) - return null; if (self.Destroyed) return null; - //var old = self.TraitsImplementing() - // .OrderByDescending( x => x.OrderPriority( self, xy, mi, underCursor ) ) - // .Select( x => x.IssueOrder( self, xy, mi, underCursor ) ) - // .FirstOrDefault( x => x != null ); - //if( old != null ) - // return old; - if( mi.Button == MouseButton.Right ) { var uim = self.World.WorldActor.Trait(); diff --git a/OpenRA.Mods.RA/Air/Helicopter.cs b/OpenRA.Mods.RA/Air/Helicopter.cs index 0367bed786..ffc4f910bc 100755 --- a/OpenRA.Mods.RA/Air/Helicopter.cs +++ b/OpenRA.Mods.RA/Air/Helicopter.cs @@ -77,6 +77,8 @@ namespace OpenRA.Mods.RA.Air if (order.OrderString == "Move") { + var target = order.TargetLocation.Clamp(self.World.Map.Bounds); + if (self.Owner == self.World.LocalPlayer) self.World.AddFrameEndTask(w => { @@ -84,12 +86,12 @@ namespace OpenRA.Mods.RA.Air w.Add(new MoveFlash(self.World, order.TargetLocation)); var line = self.TraitOrDefault(); if (line != null) - line.SetTarget(self, Target.FromOrder(order), Color.Green); + line.SetTarget(self, Target.FromCell(target), Color.Green); }); self.CancelActivity(); - self.QueueActivity(new HeliFly(Util.CenterOfCell(order.TargetLocation))); - + self.QueueActivity(new HeliFly(Util.CenterOfCell(target))); + if (Info.LandWhenIdle) { self.QueueActivity(new Turn(Info.InitialFacing)); @@ -114,7 +116,7 @@ namespace OpenRA.Mods.RA.Air w.Add(new FlashTarget(order.TargetActor)); var line = self.TraitOrDefault(); if (line != null) - line.SetTarget(self, Target.FromOrder(order), Color.Green); + line.SetTarget(self, Target.FromActor(order.TargetActor), Color.Green); }); self.CancelActivity(); diff --git a/OpenRA.Mods.RA/Air/Plane.cs b/OpenRA.Mods.RA/Air/Plane.cs index 3e3c3315b3..0ab2ba694f 100755 --- a/OpenRA.Mods.RA/Air/Plane.cs +++ b/OpenRA.Mods.RA/Air/Plane.cs @@ -90,7 +90,8 @@ namespace OpenRA.Mods.RA.Air if (order.OrderString == "Move") { UnReserve(); - + + var target = order.TargetLocation.Clamp(self.World.Map.Bounds); if (self.Owner == self.World.LocalPlayer) self.World.AddFrameEndTask(w => { @@ -98,11 +99,11 @@ namespace OpenRA.Mods.RA.Air w.Add(new MoveFlash(self.World, order.TargetLocation)); var line = self.TraitOrDefault(); if (line != null) - line.SetTarget(self, Target.FromOrder(order), Color.Green); + line.SetTarget(self, Target.FromCell(target), Color.Green); }); self.CancelActivity(); - self.QueueActivity(Fly.ToCell(order.TargetLocation)); + self.QueueActivity(Fly.ToCell(target)); } else if (order.OrderString == "Enter") @@ -120,7 +121,7 @@ namespace OpenRA.Mods.RA.Air w.Add(new FlashTarget(order.TargetActor)); var line = self.TraitOrDefault(); if (line != null) - line.SetTarget(self, Target.FromOrder(order), Color.Green); + line.SetTarget(self, Target.FromActor(order.TargetActor), Color.Green); }); self.CancelActivity(); @@ -150,7 +151,7 @@ namespace OpenRA.Mods.RA.Air public bool CanTargetLocation(Actor self, int2 location, List actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor) { IsQueued = forceQueued; - cursor = "move"; + cursor = self.World.Map.IsInMap(location) ? "move" : "move-blocked"; return true; } public bool IsQueued { get; protected set; } diff --git a/OpenRA.Mods.RA/AttackBase.cs b/OpenRA.Mods.RA/AttackBase.cs index 70a95c78d0..14023923a8 100644 --- a/OpenRA.Mods.RA/AttackBase.cs +++ b/OpenRA.Mods.RA/AttackBase.cs @@ -263,6 +263,9 @@ namespace OpenRA.Mods.RA public bool CanTargetLocation(Actor self, int2 location, List actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor) { + if (!self.World.Map.IsInMap(location)) + return false; + IsQueued = forceQueued; cursor = isHeal ? "heal" : "attack"; diff --git a/OpenRA.Mods.RA/Minelayer.cs b/OpenRA.Mods.RA/Minelayer.cs index d90cf640e2..d0b33b37bd 100644 --- a/OpenRA.Mods.RA/Minelayer.cs +++ b/OpenRA.Mods.RA/Minelayer.cs @@ -160,6 +160,9 @@ namespace OpenRA.Mods.RA public bool CanTargetLocation(Actor self, int2 location, List actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor) { + if (!self.World.Map.IsInMap(location)) + return false; + cursor = "ability"; IsQueued = forceQueued; diff --git a/OpenRA.Mods.RA/Move/Mobile.cs b/OpenRA.Mods.RA/Move/Mobile.cs index 4887a814ca..a199fc53c0 100755 --- a/OpenRA.Mods.RA/Move/Mobile.cs +++ b/OpenRA.Mods.RA/Move/Mobile.cs @@ -211,7 +211,10 @@ namespace OpenRA.Mods.RA.Move public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "Move") - PerformMove(self, order.TargetLocation, order.Queued && !self.IsIdle); + { + var target = order.TargetLocation.Clamp(self.World.Map.Bounds); + PerformMove(self, target, order.Queued && !self.IsIdle); + } } public string VoicePhraseForOrder(Actor self, Order order) diff --git a/OpenRA.Mods.RA/RallyPoint.cs b/OpenRA.Mods.RA/RallyPoint.cs index ee8478692e..55a0dd2a30 100755 --- a/OpenRA.Mods.RA/RallyPoint.cs +++ b/OpenRA.Mods.RA/RallyPoint.cs @@ -76,7 +76,7 @@ namespace OpenRA.Mods.RA public bool CanTargetLocation(Actor self, int2 location, List actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor) { - return true; + return self.World.Map.IsInMap(location); } public bool IsQueued { get { return false; } } // unused