Remove plumbing for trait unit tests.

This commit is contained in:
David Jiménez
2015-04-01 22:18:53 +02:00
committed by Paul Chote
parent 8d0acaaa4f
commit 044b51742f
14 changed files with 29 additions and 564 deletions

View File

@@ -29,16 +29,8 @@ namespace OpenRA.Mods.Common.Traits
All = TransientActors | BlockedByMovers
}
public interface IMobileInfo : IMoveInfo
{
int MovementCostForCell(World world, CPos cell);
bool CanEnterCell(World world, Actor self, CPos cell, out int movementCost, Actor ignoreActor = null, CellConditions check = CellConditions.All);
bool CanEnterCell(World world, Actor self, CPos cell, Actor ignoreActor = null, CellConditions check = CellConditions.All);
int GetMovementClass(TileSet tileset);
}
[Desc("Unit is able to move.")]
public class MobileInfo : IMobileInfo, IOccupySpaceInfo, IFacingInfo, UsesInit<FacingInit>, UsesInit<LocationInit>, UsesInit<SubCellInit>
public class MobileInfo : IMoveInfo, IOccupySpaceInfo, IFacingInfo, UsesInit<FacingInit>, UsesInit<LocationInit>, UsesInit<SubCellInit>
{
[FieldLoader.LoadUsing("LoadSpeeds")]
[Desc("Set Water: 0 for ground units and lower the value on rough terrain.")]

View File

@@ -32,9 +32,9 @@ namespace OpenRA.Mods.Common.Traits
/// Calculates a path for the actor from source to destination
/// </summary>
/// <returns>A path from start to target</returns>
List<CPos> FindUnitPath(CPos source, CPos target, IActor self);
List<CPos> FindUnitPath(CPos source, CPos target, Actor self);
List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, IActor self);
List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self);
/// <summary>
/// Calculates a path given a search specification
@@ -52,16 +52,16 @@ namespace OpenRA.Mods.Common.Traits
public class PathFinder : IPathFinder
{
static readonly List<CPos> EmptyPath = new List<CPos>(0);
readonly IWorld world;
readonly World world;
public PathFinder(IWorld world)
public PathFinder(World world)
{
this.world = world;
}
public List<CPos> FindUnitPath(CPos source, CPos target, IActor self)
public List<CPos> FindUnitPath(CPos source, CPos target, Actor self)
{
var mi = self.Info.Traits.Get<IMobileInfo>();
var mi = self.Info.Traits.Get<MobileInfo>();
// If a water-land transition is required, bail early
var domainIndex = world.WorldActor.TraitOrDefault<DomainIndex>();
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
return pb;
}
public List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, IActor self)
public List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self)
{
var mi = self.Info.Traits.Get<MobileInfo>();
var targetCell = world.Map.CellContaining(target);