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 actorsAt = self.World.ActorMap.GetUnitsAt( xy ).ToList();
var forceAttack = mi.Modifiers.HasModifier(Modifiers.Ctrl); var forceAttack = mi.Modifiers.HasModifier(Modifiers.Ctrl);
var forceMove = mi.Modifiers.HasModifier(Modifiers.Alt);
var forceQueue = mi.Modifiers.HasModifier(Modifiers.Shift); var forceQueue = mi.Modifiers.HasModifier(Modifiers.Shift);
string cursor = null; string cursor = null;
if( underCursor != 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 ) ); 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 ) ); return new UnitOrderResult( self, o.Order, o.Trait, cursor, Target.FromCell( xy ) );
} }
} }

View File

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

View File

@@ -247,12 +247,12 @@ namespace OpenRA.Mods.RA.Air
public string OrderID { get { return "Move"; } } public string OrderID { get { return "Move"; } }
public int OrderPriority { get { return 4; } } 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; 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; IsQueued = forceQueued;
cursor = self.World.Map.IsInMap(location) ? "move" : "move-blocked"; 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 string OrderID { get; private set; }
public int OrderPriority { 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; IsQueued = forceQueued;
@@ -220,7 +220,7 @@ namespace OpenRA.Mods.RA
return playerRelationship == Stance.Enemy || forceAttack; 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)) if (!self.World.Map.IsInMap(location))
return false; return false;

View File

@@ -75,9 +75,9 @@ namespace OpenRA.Mods.RA
this.captureTypes = captureTypes; 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 ci = target.Info.Traits.Get<CapturableInfo>();
var playerRelationship = self.Owner.Stances[ target.Owner ]; var playerRelationship = self.Owner.Stances[ target.Owner ];

View File

@@ -56,13 +56,11 @@ namespace OpenRA.Mods.RA
class EngineerRepairOrderTargeter : UnitTraitOrderTargeter<Building> class EngineerRepairOrderTargeter : UnitTraitOrderTargeter<Building>
{ {
public EngineerRepairOrderTargeter() 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>()) if (!target.HasTrait<RepairableBuilding>())
return false; return false;

View File

@@ -219,12 +219,12 @@ namespace OpenRA.Mods.RA
public string OrderID { get { return "Harvest";}} public string OrderID { get { return "Harvest";}}
public int OrderPriority { get { return 10; } } 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; 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 // Don't leak info about resources under the shroud
if (!self.World.LocalShroud.IsExplored(location)) return false; 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 string OrderID { get { return "BeginMinefield"; } }
public int OrderPriority { get { return 5; } } 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; 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)) if (!self.World.Map.IsInMap(location))
return false; return false;

View File

@@ -433,12 +433,12 @@ namespace OpenRA.Mods.RA.Move
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 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; 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; IsQueued = forceQueued;
cursor = "move"; cursor = "move";

View File

@@ -35,14 +35,14 @@ namespace OpenRA.Mods.RA.Orders
public string OrderID { get; private set; } public string OrderID { get; private set; }
public int OrderPriority { 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; IsQueued = forceQueued;
cursor = useDeployCursor() ? "deploy" : "deploy-blocked"; cursor = useDeployCursor() ? "deploy" : "deploy-blocked";
return self == target; 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; return false;
} }

View File

@@ -25,9 +25,9 @@ namespace OpenRA.Mods.RA.Orders
this.useEnterCursor = useEnterCursor; 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; if( !canTarget( target ) ) return false;
cursor = useEnterCursor(target) ? "enter" : "enter-blocked"; cursor = useEnterCursor(target) ? "enter" : "enter-blocked";
IsQueued = forceQueued; IsQueued = forceQueued;

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Orders
public string OrderID { get; private set; } public string OrderID { get; private set; }
public int OrderPriority { 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( self == null ) throw new ArgumentNullException( "self" );
if( target == null ) throw new ArgumentNullException( "target" ); if( target == null ) throw new ArgumentNullException( "target" );
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Orders
return true; 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; 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; if( !target.HasTrait<T>() ) return false;
IsQueued = forceQueued; IsQueued = forceQueued;

View File

@@ -59,12 +59,12 @@ namespace OpenRA.Mods.RA
public string OrderID { get { return "SetRallyPoint"; } } public string OrderID { get { return "SetRallyPoint"; } }
public int OrderPriority { get { return 0; } } 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; 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)) 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.AppearsHostileTo(self)) return false;
if (!target.HasTrait<AcceptsSupplies>()) return false; if (!target.HasTrait<AcceptsSupplies>()) return false;