fixed #849 -- forceMove plumbing removed, noone uses it.

This commit is contained in:
Chris Forbes
2011-08-16 18:58:50 +12:00
parent 67b4ef3084
commit 257bd6f431
14 changed files with 31 additions and 34 deletions

View File

@@ -90,13 +90,12 @@ namespace OpenRA.Orders
var actorsAt = self.World.ActorMap.GetUnitsAt( xy ).ToList();
var forceAttack = mi.Modifiers.HasModifier(Modifiers.Ctrl);
var forceMove = mi.Modifiers.HasModifier(Modifiers.Alt);
var forceQueue = mi.Modifiers.HasModifier(Modifiers.Shift);
string cursor = null;
if( underCursor != null )
if (o.Order.CanTargetActor(self, underCursor, forceAttack, forceMove, forceQueue, ref cursor))
if (o.Order.CanTargetActor(self, underCursor, forceAttack, forceQueue, ref cursor))
return new UnitOrderResult( self, o.Order, o.Trait, cursor, Target.FromActor( underCursor ) );
if (o.Order.CanTargetLocation(self, xy, actorsAt, forceAttack, forceMove, forceQueue, ref cursor))
if (o.Order.CanTargetLocation(self, xy, actorsAt, forceAttack, forceQueue, ref cursor))
return new UnitOrderResult( self, o.Order, o.Trait, cursor, Target.FromCell( xy ) );
}
}

View File

@@ -45,8 +45,8 @@ namespace OpenRA.Traits
{
string OrderID { get; }
int OrderPriority { get; }
bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueue, ref string cursor);
bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueue, ref string cursor);
bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueue, ref string cursor);
bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueue, ref string cursor);
bool IsQueued { get; }
}

View File

@@ -247,12 +247,12 @@ namespace OpenRA.Mods.RA.Air
public string OrderID { get { return "Move"; } }
public int OrderPriority { get { return 4; } }
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
return false;
}
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueued, ref string cursor)
{
IsQueued = forceQueued;
cursor = self.World.Map.IsInMap(location) ? "move" : "move-blocked";

View File

@@ -203,7 +203,7 @@ namespace OpenRA.Mods.RA
public string OrderID { get; private set; }
public int OrderPriority { get; private set; }
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
IsQueued = forceQueued;
@@ -220,7 +220,7 @@ namespace OpenRA.Mods.RA
return playerRelationship == Stance.Enemy || forceAttack;
}
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueued, ref string cursor)
{
if (!self.World.Map.IsInMap(location))
return false;

View File

@@ -75,9 +75,9 @@ namespace OpenRA.Mods.RA
this.captureTypes = captureTypes;
}
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
if( !base.CanTargetActor( self, target, forceAttack, forceMove, forceQueued, ref cursor ) ) return false;
if( !base.CanTargetActor( self, target, forceAttack, forceQueued, ref cursor ) ) return false;
var ci = target.Info.Traits.Get<CapturableInfo>();
var playerRelationship = self.Owner.Stances[ target.Owner ];

View File

@@ -56,13 +56,11 @@ namespace OpenRA.Mods.RA
class EngineerRepairOrderTargeter : UnitTraitOrderTargeter<Building>
{
public EngineerRepairOrderTargeter()
: base( "EngineerRepair", 6, "goldwrench", false, true )
{
}
: base( "EngineerRepair", 6, "goldwrench", false, true ) { }
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
if( !base.CanTargetActor( self, target, forceAttack, forceMove, forceQueued, ref cursor ) ) return false;
if( !base.CanTargetActor( self, target, forceAttack, forceQueued, ref cursor ) ) return false;
if (!target.HasTrait<RepairableBuilding>())
return false;

View File

@@ -219,12 +219,12 @@ namespace OpenRA.Mods.RA
public string OrderID { get { return "Harvest";}}
public int OrderPriority { get { return 10; } }
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
return false;
}
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueued, ref string cursor)
{
// Don't leak info about resources under the shroud
if (!self.World.LocalShroud.IsExplored(location)) return false;

View File

@@ -153,12 +153,12 @@ namespace OpenRA.Mods.RA
public string OrderID { get { return "BeginMinefield"; } }
public int OrderPriority { get { return 5; } }
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
return false;
}
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueued, ref string cursor)
{
if (!self.World.Map.IsInMap(location))
return false;

View File

@@ -433,12 +433,12 @@ namespace OpenRA.Mods.RA.Move
public int OrderPriority { get { return 4; } }
public bool IsQueued { get; protected set; }
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
return false;
}
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueued, ref string cursor)
{
IsQueued = forceQueued;
cursor = "move";

View File

@@ -35,14 +35,14 @@ namespace OpenRA.Mods.RA.Orders
public string OrderID { get; private set; }
public int OrderPriority { get; private set; }
public bool CanTargetActor( Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor )
public bool CanTargetActor( Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor )
{
IsQueued = forceQueued;
cursor = useDeployCursor() ? "deploy" : "deploy-blocked";
return self == target;
}
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueued, ref string cursor)
{
return false;
}

View File

@@ -25,9 +25,9 @@ namespace OpenRA.Mods.RA.Orders
this.useEnterCursor = useEnterCursor;
}
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
if( !base.CanTargetActor( self, target, forceAttack, forceMove, forceQueued, ref cursor ) ) return false;
if( !base.CanTargetActor( self, target, forceAttack, forceQueued, ref cursor ) ) return false;
if( !canTarget( target ) ) return false;
cursor = useEnterCursor(target) ? "enter" : "enter-blocked";
IsQueued = forceQueued;

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Orders
public string OrderID { get; private set; }
public int OrderPriority { get; private set; }
public virtual bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public virtual bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
if( self == null ) throw new ArgumentNullException( "self" );
if( target == null ) throw new ArgumentNullException( "target" );
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Orders
return true;
}
public virtual bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public virtual bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueued, ref string cursor)
{
return false;
}
@@ -61,9 +61,9 @@ namespace OpenRA.Mods.RA.Orders
{
}
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
if( !base.CanTargetActor( self, target, forceAttack, forceMove, forceQueued, ref cursor ) ) return false;
if( !base.CanTargetActor( self, target, forceAttack, forceQueued, ref cursor ) ) return false;
if( !target.HasTrait<T>() ) return false;
IsQueued = forceQueued;

View File

@@ -59,12 +59,12 @@ namespace OpenRA.Mods.RA
public string OrderID { get { return "SetRallyPoint"; } }
public int OrderPriority { get { return 0; } }
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
return false;
}
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueued, ref string cursor)
{
if (self.World.Map.IsInMap(location))
{

View File

@@ -67,9 +67,9 @@ namespace OpenRA.Mods.RA
{
}
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceMove, bool forceQueued, ref string cursor)
public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor)
{
if (!base.CanTargetActor(self, target, forceAttack, forceMove, forceQueued, ref cursor)) return false;
if (!base.CanTargetActor(self, target, forceAttack, forceQueued, ref cursor)) return false;
if (target.AppearsHostileTo(self)) return false;
if (!target.HasTrait<AcceptsSupplies>()) return false;