From e9faf62c4a84e90d687b9a925f6eed2632969654 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 27 Oct 2009 00:05:38 +1300 Subject: [PATCH] move cancels attack --- OpenRa.Game/Game.cs | 2 +- OpenRa.Game/MoveOrder.cs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index b85df63d52..aa05a6babf 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -242,7 +242,7 @@ namespace OpenRa.Game unit = new Actor(name, (1 / 24f * producer.CenterLocation).ToInt2(), player); var mobile = unit.traits.Get(); mobile.facing = 128; - mobile.QueueActivity(new Traits.Mobile.MoveTo(unit.Location + new int2(0, 3))); + mobile.QueueActivity(new Mobile.MoveTo(unit.Location + new int2(0, 3))); } world.AddFrameEndTask(_ => world.Add(unit)); diff --git a/OpenRa.Game/MoveOrder.cs b/OpenRa.Game/MoveOrder.cs index 9931d94d22..c4257f3f61 100644 --- a/OpenRa.Game/MoveOrder.cs +++ b/OpenRa.Game/MoveOrder.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; -using System.Text; +using System.Text; +using System.Linq; +using OpenRa.Game.Traits; namespace OpenRa.Game { @@ -30,9 +32,14 @@ namespace OpenRa.Game { if (Game.LocalPlayer == Unit.Owner) Game.PlaySound(Game.SovietVoices.First.GetNext() + GetVoiceSuffix(), false); - var mobile = Unit.traits.Get(); + + var mobile = Unit.traits.Get(); mobile.Cancel(Unit); - mobile.QueueActivity( new Traits.Mobile.MoveTo( Destination ) ); + mobile.QueueActivity( new Mobile.MoveTo( Destination ) ); + + var attackBase = Unit.traits.WithInterface().FirstOrDefault(); + if (attackBase != null) + attackBase.target = null; /* move cancels attack order */ } } }