From 75344925266c1f9eb774a68476a0cc80840e6329 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 9 Nov 2009 22:36:56 +1300 Subject: [PATCH] #48 --- OpenRa.Game/UnitOrders.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/OpenRa.Game/UnitOrders.cs b/OpenRa.Game/UnitOrders.cs index 99069a5390..490b2143a3 100755 --- a/OpenRa.Game/UnitOrders.cs +++ b/OpenRa.Game/UnitOrders.cs @@ -27,17 +27,13 @@ namespace OpenRa.Game { const int RangeTolerance = 1; /* how far inside our maximum range we should try to sit */ var mobile = order.Subject.traits.GetOrDefault(); + /* todo: choose the appropriate weapon, when only one works against this target */ var weapon = order.Subject.unitInfo.Primary ?? order.Subject.unitInfo.Secondary; mobile.Cancel(order.Subject); - // TODO: this block should be a separate activity; "MoveNear", maybe? - { - /* todo: choose the appropriate weapon, when only one works against this target */ - var range = Rules.WeaponInfo[weapon].Range; - - mobile.QueueActivity( - new Traits.Activities.Follow(order.TargetActor, Math.Max(0, (int)range - RangeTolerance))); - } + mobile.QueueActivity( + new Traits.Activities.Follow(order.TargetActor, + Math.Max(0, (int)Rules.WeaponInfo[weapon].Range - RangeTolerance))); order.Subject.traits.Get().target = order.TargetActor; break;