Make CanTarget modifiers a ref parameter.
This commit is contained in:
@@ -130,7 +130,7 @@ namespace OpenRA.Orders
|
|||||||
modifiers |= TargetModifiers.ForceMove;
|
modifiers |= TargetModifiers.ForceMove;
|
||||||
|
|
||||||
string cursor = null;
|
string cursor = null;
|
||||||
if (o.Order.CanTarget(self, target, actorsAt, modifiers, ref cursor))
|
if (o.Order.CanTarget(self, target, actorsAt, ref modifiers, ref cursor))
|
||||||
return new UnitOrderResult(self, o.Order, o.Trait, cursor, target);
|
return new UnitOrderResult(self, o.Order, o.Trait, cursor, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
string OrderID { get; }
|
string OrderID { get; }
|
||||||
int OrderPriority { get; }
|
int OrderPriority { get; }
|
||||||
bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor);
|
bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor);
|
||||||
bool IsQueued { get; }
|
bool IsQueued { get; }
|
||||||
bool OverrideSelection { get; }
|
bool OverrideSelection { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
|
|
||||||
public AircraftMoveOrderTargeter(AircraftInfo info) { this.info = info; }
|
public AircraftMoveOrderTargeter(AircraftInfo info) { this.info = info; }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
if (target.Type != TargetType.Terrain)
|
if (target.Type != TargetType.Terrain)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
public int OrderPriority { get; private set; }
|
public int OrderPriority { get; private set; }
|
||||||
public bool OverrideSelection { get { return true; } }
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
if (target.Type != TargetType.Actor)
|
if (target.Type != TargetType.Actor)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
public abstract bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor);
|
public abstract bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor);
|
||||||
public abstract bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor);
|
public abstract bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor);
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
var type = target.Type;
|
var type = target.Type;
|
||||||
if (type != TargetType.Actor && type != TargetType.FrozenActor)
|
if (type != TargetType.Actor && type != TargetType.FrozenActor)
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public int OrderPriority { get; private set; }
|
public int OrderPriority { get; private set; }
|
||||||
public bool OverrideSelection { get { return true; } }
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
bool CanTargetActor(Actor self, Target target, TargetModifiers modifiers, ref string cursor)
|
bool CanTargetActor(Actor self, Target target, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
||||||
|
|
||||||
@@ -326,13 +326,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
switch (target.Type)
|
switch (target.Type)
|
||||||
{
|
{
|
||||||
case TargetType.Actor:
|
case TargetType.Actor:
|
||||||
case TargetType.FrozenActor:
|
case TargetType.FrozenActor:
|
||||||
return CanTargetActor(self, target, modifiers, ref cursor);
|
return CanTargetActor(self, target, ref modifiers, ref cursor);
|
||||||
case TargetType.Terrain:
|
case TargetType.Terrain:
|
||||||
return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), othersAtTarget, modifiers, ref cursor);
|
return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), othersAtTarget, modifiers, ref cursor);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public int OrderPriority { get { return 0; } }
|
public int OrderPriority { get { return 0; } }
|
||||||
public bool OverrideSelection { get { return true; } }
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
if (target.Type != TargetType.Terrain)
|
if (target.Type != TargetType.Terrain)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public bool IsQueued { get; protected set; }
|
public bool IsQueued { get; protected set; }
|
||||||
public bool OverrideSelection { get { return true; } }
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
if (target.Type != TargetType.Terrain)
|
if (target.Type != TargetType.Terrain)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -707,7 +707,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public int OrderPriority { get { return 4; } }
|
public int OrderPriority { get { return 4; } }
|
||||||
public bool IsQueued { get; protected set; }
|
public bool IsQueued { get; protected set; }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
if (rejectMove || !target.IsValidFor(self))
|
if (rejectMove || !target.IsValidFor(self))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
public int OrderPriority { get { return 5; } }
|
public int OrderPriority { get { return 5; } }
|
||||||
public bool OverrideSelection { get { return true; } }
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
if (target.Type != TargetType.Terrain)
|
if (target.Type != TargetType.Terrain)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
public bool IsQueued { get; protected set; }
|
public bool IsQueued { get; protected set; }
|
||||||
public bool OverrideSelection { get { return true; } }
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
// TODO: When target modifiers are configurable this needs to be revisited
|
// TODO: When target modifiers are configurable this needs to be revisited
|
||||||
if (modifiers.HasModifier(TargetModifiers.ForceMove) || modifiers.HasModifier(TargetModifiers.ForceQueue))
|
if (modifiers.HasModifier(TargetModifiers.ForceMove) || modifiers.HasModifier(TargetModifiers.ForceQueue))
|
||||||
|
|||||||
Reference in New Issue
Block a user