Merge IOrderTargeter.CanTargetActor and CanTargetLocation.
This commit is contained in:
@@ -96,11 +96,9 @@ namespace OpenRA.Orders
|
||||
modifiers |= TargetModifiers.ForceMove;
|
||||
|
||||
string cursor = null;
|
||||
if (underCursor != null)
|
||||
if (o.Order.CanTargetActor(self, underCursor, modifiers, ref cursor))
|
||||
return new UnitOrderResult(self, o.Order, o.Trait, cursor, Target.FromActor(underCursor));
|
||||
if (o.Order.CanTargetLocation(self, xy, actorsAt, modifiers, ref cursor))
|
||||
return new UnitOrderResult(self, o.Order, o.Trait, cursor, Target.FromCell(xy));
|
||||
var target = underCursor != null ? Target.FromActor(underCursor) : Target.FromCell(xy);
|
||||
if (o.Order.CanTarget(self, target, actorsAt, modifiers, ref cursor))
|
||||
return new UnitOrderResult(self, o.Order, o.Trait, cursor, target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
string OrderID { get; }
|
||||
int OrderPriority { get; }
|
||||
bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor);
|
||||
bool CanTargetLocation(Actor self, CPos location, List<Actor> actorsAtLocation, TargetModifiers modifiers, ref string cursor);
|
||||
bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor);
|
||||
bool IsQueued { get; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user