Changes to map.cs, rename IPositionable.IsLeaving{ => Cell}, add IPositionable.GetValidSubCell

This commit is contained in:
atlimit8
2014-08-24 02:54:49 -05:00
parent 63c28ee4d7
commit e29b9edfc1
13 changed files with 68 additions and 43 deletions

14
OpenRA.Mods.RA/Move/Move.cs Executable file → Normal file
View File

@@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA.Move
public Move(CPos destination, SubCell subCell, WRange nearEnough)
{
this.getPath = (self, mobile) => self.World.WorldActor.Trait<PathFinder>()
.FindUnitPathToRange(mobile.fromCell, subCell, self.World.Map.CenterOf(destination, subCell), nearEnough, self);
.FindUnitPathToRange(mobile.fromCell, subCell, self.World.Map.CenterOfSubCell(destination, subCell), nearEnough, self);
this.destination = destination;
this.nearEnough = nearEnough;
}
@@ -158,8 +158,8 @@ namespace OpenRA.Mods.RA.Move
mobile.SetLocation(mobile.fromCell, mobile.fromSubCell, nextCell.Value.First, nextCell.Value.Second);
var move = new MoveFirstHalf(
this,
self.World.Map.CenterOf(mobile.fromCell, mobile.fromSubCell),
Util.BetweenCells(self.World, mobile.fromCell, mobile.toCell) + (self.World.Map.OffsetOf(mobile.fromSubCell) + self.World.Map.OffsetOf(mobile.toSubCell)) / 2,
self.World.Map.CenterOfSubCell(mobile.fromCell, mobile.fromSubCell),
Util.BetweenCells(self.World, mobile.fromCell, mobile.toCell) + (self.World.Map.OffsetOfSubCell(mobile.fromSubCell) + self.World.Map.OffsetOfSubCell(mobile.toSubCell)) / 2,
mobile.Facing,
mobile.Facing,
0);
@@ -245,7 +245,7 @@ namespace OpenRA.Mods.RA.Move
hasWaited = false;
path.RemoveAt(path.Count - 1);
var subCell = mobile.GetAvailableSubcell(nextCell, SubCell.AnySubCell, ignoreBuilding);
var subCell = mobile.GetAvailableSubCell(nextCell, SubCell.AnySubCell, ignoreBuilding);
return Pair.New(nextCell, subCell);
}
@@ -355,15 +355,15 @@ namespace OpenRA.Mods.RA.Move
protected override MovePart OnComplete(Actor self, Mobile mobile, Move parent)
{
var fromSubcellOffset = self.World.Map.OffsetOf(mobile.fromSubCell);
var toSubcellOffset = self.World.Map.OffsetOf(mobile.toSubCell);
var fromSubcellOffset = self.World.Map.OffsetOfSubCell(mobile.fromSubCell);
var toSubcellOffset = self.World.Map.OffsetOfSubCell(mobile.toSubCell);
var nextCell = parent.PopPath(self, mobile);
if (nextCell != null)
{
if (IsTurn(mobile, nextCell.Value.First))
{
var nextSubcellOffset = self.World.Map.OffsetOf(nextCell.Value.Second);
var nextSubcellOffset = self.World.Map.OffsetOfSubCell(nextCell.Value.Second);
var ret = new MoveFirstHalf(
move,
Util.BetweenCells(self.World, mobile.fromCell, mobile.toCell) + (fromSubcellOffset + toSubcellOffset) / 2,