Replace WPos.ToCPos -> Map.CellContaining.

This commit is contained in:
Paul Chote
2013-09-17 22:57:30 +12:00
parent 4bc09692e0
commit 9487f49cd5
43 changed files with 81 additions and 83 deletions

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Activities
if (target.Type != TargetType.Actor)
return NextActivity;
if (!Util.AdjacentCells(target).Any(c => c == self.Location))
if (!Util.AdjacentCells(self.World, target).Any(c => c == self.Location))
return Util.SequenceActivities(new MoveAdjacentTo(self, target), this);
// Move to the middle of the target, ignoring impassable tiles

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Activities
// TODO: Queue a move order to the transport? need to be
// careful about units that can't path to the transport
var cells = Util.AdjacentCells(Target.FromActor(transport));
var cells = Util.AdjacentCells(self.World, Target.FromActor(transport));
if (!cells.Contains(self.Location))
return NextActivity;

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Activities
return Util.SequenceActivities(
new MoveAdjacentTo(self, Target.FromActor(rearmTarget)),
movement.MoveTo(rearmTarget.CenterPosition.ToCPos(), rearmTarget),
movement.MoveTo(self.World.Map.CellContaining(rearmTarget.CenterPosition), rearmTarget),
new Rearm(self),
new Repair(rearmTarget),
this);

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Activities
movementClass = (uint)mobile.Info.GetMovementClass(self.World.TileSet);
if (target.IsValidFor(self))
targetPosition = target.CenterPosition.ToCPos();
targetPosition = self.World.Map.CellContaining(target.CenterPosition);
repath = true;
}
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.RA.Activities
{
// Check if the target has moved
var oldTargetPosition = targetPosition;
targetPosition = target.CenterPosition.ToCPos();
targetPosition = self.World.Map.CellContaining(target.CenterPosition);
var shroudStop = ShouldStop(self, oldTargetPosition);
if (shroudStop || (!repath && ShouldRepath(self, oldTargetPosition)))
@@ -101,7 +101,7 @@ namespace OpenRA.Mods.RA.Activities
protected virtual IEnumerable<CPos> CandidateMovementCells(Actor self)
{
return Util.AdjacentCells(target);
return Util.AdjacentCells(self.World, target);
}
void UpdateInnerPath(Actor self)