Fixes issues with support powers and adds property to all IOrderGenerator classes to determine priority over selection in the left-click order scheme.

This commit is contained in:
Bynnar18
2015-02-28 15:49:15 -06:00
parent 7b46b76329
commit 0abe8f9b2b
17 changed files with 41 additions and 7 deletions

View File

@@ -96,10 +96,10 @@ namespace OpenRA.Orders
var o = OrderForUnit(underCursor, target, mi);
if (o == null || o.Trait is IMove)
return true;
if (o != null && o.Order.OverrideSelection)
return false;
return false;
return true;
}
static UnitOrderResult OrderForUnit(Actor self, Target target, MouseInput mi)

View File

@@ -79,6 +79,7 @@ namespace OpenRA.Traits
int OrderPriority { get; }
bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor);
bool IsQueued { get; }
bool OverrideSelection { get; }
}
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }

View File

@@ -68,9 +68,15 @@ namespace OpenRA.Widgets
dragStart = xy;
// Place buildings
if (!useClassicMouseStyle || !World.Selection.Actors.Any())
// Place buildings, use support powers, and other non-unit things
if (!(World.OrderGenerator is UnitOrderGenerator))
{
ApplyOrders(World, xy, mi);
dragStart = dragEnd = null;
YieldMouseFocus(mi);
lastMousePosition = xy;
return true;
}
}
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Move && dragStart.HasValue)
@@ -114,8 +120,6 @@ namespace OpenRA.Widgets
World.Selection.Combine(World, newSelection, mi.Modifiers.HasModifier(Modifiers.Shift), dragStart == xy);
}
}
else if (useClassicMouseStyle)
ApplyOrders(World, xy, mi);
dragStart = dragEnd = null;
YieldMouseFocus(mi);