Merge IOrderTargeter.CanTargetActor and CanTargetLocation.

This commit is contained in:
Paul Chote
2013-08-07 23:23:22 +12:00
parent 4f3c9aa0af
commit e4d1c654ed
17 changed files with 53 additions and 76 deletions

View File

@@ -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);
}
}

View File

@@ -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; }
}