diff --git a/OpenRa.Game/Controller.cs b/OpenRa.Game/Controller.cs index 71e4fef5ed..c85e7ff79d 100644 --- a/OpenRa.Game/Controller.cs +++ b/OpenRa.Game/Controller.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -63,7 +63,9 @@ namespace OpenRa if (voicedActor != null) { - Sound.PlayVoice(isAttack ? "Attack" : "Move", voicedActor); + + if(voicedActor.traits.GetOrDefault().CanEnterCell(xy.ToInt2())) + Sound.PlayVoice(isAttack ? "Attack" : "Move", voicedActor); if (isMove) world.Add(new Effects.MoveFlash(world, Game.CellSize * xy)); diff --git a/OpenRa.Game/Orders/UnitOrderGenerator.cs b/OpenRa.Game/Orders/UnitOrderGenerator.cs index 4eac23808e..99a5e86151 100644 --- a/OpenRa.Game/Orders/UnitOrderGenerator.cs +++ b/OpenRa.Game/Orders/UnitOrderGenerator.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -65,14 +65,13 @@ namespace OpenRa.Orders string CursorForOrderString(string s, Actor a, int2 location) { - var movement = a.traits.GetOrDefault(); switch (s) { case "Attack": return "attack"; case "Heal": return "heal"; case "C4": return "c4"; - case "Move": - if (movement.CanEnterCell(location)) + case "Move": + if (a.traits.GetOrDefault().CanEnterCell(location)) return "move"; else return "move-blocked"; diff --git a/OpenRa.Game/Traits/ConstructionYard.cs b/OpenRa.Game/Traits/ConstructionYard.cs index b3dea4ab28..c3b7d836fc 100644 --- a/OpenRa.Game/Traits/ConstructionYard.cs +++ b/OpenRa.Game/Traits/ConstructionYard.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -50,8 +50,10 @@ namespace OpenRa.Traits if (!mi.Modifiers.HasModifier(Modifiers.Alt)) return null; if (!self.World.IsActorCrushableByActor(underCursor, self)) return null; } - - return new Order("Move", self, xy); + if (self.traits.GetOrDefault().CanEnterCell(xy)) + return new Order("Move", self, xy); + else + return null; } public void ResolveOrder(Actor self, Order order) diff --git a/OpenRa.Game/Traits/Helicopter.cs b/OpenRa.Game/Traits/Helicopter.cs index 8dcbf074c5..21e9cb24f0 100644 --- a/OpenRa.Game/Traits/Helicopter.cs +++ b/OpenRa.Game/Traits/Helicopter.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -45,7 +45,10 @@ namespace OpenRa.Traits if (mi.Button == MouseButton.Left) return null; if (underCursor == null) - return new Order("Move", self, xy); + { + if (self.traits.GetOrDefault().CanEnterCell(xy)) + return new Order("Move", self, xy); + } if (HeliCanEnter(underCursor) && underCursor.Owner == self.Owner @@ -68,7 +71,7 @@ namespace OpenRa.Traits self.CancelActivity(); self.QueueActivity(new HeliFly(Util.CenterOfCell(order.TargetLocation))); self.QueueActivity(new Turn(self.Info.Traits.GetOrDefault().InitialFacing)); - self.QueueActivity(new HeliLand(true)); + self.QueueActivity(new HeliLand(true)); } if (order.OrderString == "Enter") diff --git a/OpenRa.Game/Traits/Mobile.cs b/OpenRa.Game/Traits/Mobile.cs index 912ef15f0f..6cb373778e 100644 --- a/OpenRa.Game/Traits/Mobile.cs +++ b/OpenRa.Game/Traits/Mobile.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -92,8 +92,11 @@ namespace OpenRa.Traits { if (order.OrderString == "Move") { - self.CancelActivity(); - self.QueueActivity(new Activities.Move(order.TargetLocation, 8)); + if (self.traits.GetOrDefault().CanEnterCell(order.TargetLocation)) + { + self.CancelActivity(); + self.QueueActivity(new Activities.Move(order.TargetLocation, 8)); + } } } diff --git a/OpenRa.Game/Traits/Plane.cs b/OpenRa.Game/Traits/Plane.cs index d667dcfeab..2c48ca9515 100644 --- a/OpenRa.Game/Traits/Plane.cs +++ b/OpenRa.Game/Traits/Plane.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -46,8 +46,9 @@ namespace OpenRa.Traits { if (mi.Button == MouseButton.Left) return null; if (underCursor == null) - return new Order("Move", self, xy); - + { + return new Order("Move", self, xy); + } if (PlaneCanEnter(underCursor) && underCursor.Owner == self.Owner && !Reservable.IsReserved(underCursor))