Make MobileInfo.SubCellOffsets static.
This commit is contained in:
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
return passability.ToBits();
|
||||
}
|
||||
|
||||
public readonly Dictionary<SubCell, PVecInt> SubCellOffsets = new Dictionary<SubCell, PVecInt>()
|
||||
public static readonly Dictionary<SubCell, PVecInt> SubCellOffsets = new Dictionary<SubCell, PVecInt>()
|
||||
{
|
||||
{SubCell.TopLeft, new PVecInt(-7,-6)},
|
||||
{SubCell.TopRight, new PVecInt(6,-6)},
|
||||
@@ -197,7 +197,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
if (init.Contains<LocationInit>())
|
||||
{
|
||||
this.__fromCell = this.__toCell = init.Get<LocationInit, CPos>();
|
||||
this.PxPosition = Util.CenterOfCell(fromCell) + info.SubCellOffsets[fromSubCell];
|
||||
this.PxPosition = Util.CenterOfCell(fromCell) + MobileInfo.SubCellOffsets[fromSubCell];
|
||||
}
|
||||
|
||||
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : info.InitialFacing;
|
||||
@@ -207,7 +207,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
public void SetPosition(Actor self, CPos cell)
|
||||
{
|
||||
SetLocation(cell,fromSubCell, cell,fromSubCell);
|
||||
PxPosition = Util.CenterOfCell(fromCell) + Info.SubCellOffsets[fromSubCell];
|
||||
PxPosition = Util.CenterOfCell(fromCell) + MobileInfo.SubCellOffsets[fromSubCell];
|
||||
FinishedMoving(self);
|
||||
}
|
||||
|
||||
|
||||
@@ -144,8 +144,8 @@ namespace OpenRA.Mods.RA.Move
|
||||
mobile.SetLocation( mobile.fromCell, mobile.fromSubCell, nextCell.Value.First, nextCell.Value.Second );
|
||||
var move = new MoveFirstHalf(
|
||||
this,
|
||||
Util.CenterOfCell( mobile.fromCell ) + mobile.Info.SubCellOffsets[mobile.fromSubCell],
|
||||
Util.BetweenCells( mobile.fromCell, mobile.toCell ) + (mobile.Info.SubCellOffsets[mobile.fromSubCell] + mobile.Info.SubCellOffsets[mobile.toSubCell] ) / 2,
|
||||
Util.CenterOfCell( mobile.fromCell ) + MobileInfo.SubCellOffsets[mobile.fromSubCell],
|
||||
Util.BetweenCells( mobile.fromCell, mobile.toCell ) + (MobileInfo.SubCellOffsets[mobile.fromSubCell] + MobileInfo.SubCellOffsets[mobile.toSubCell] ) / 2,
|
||||
mobile.Facing,
|
||||
mobile.Facing,
|
||||
0 );
|
||||
@@ -335,15 +335,15 @@ namespace OpenRA.Mods.RA.Move
|
||||
|
||||
protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent )
|
||||
{
|
||||
var fromSubcellOffset = mobile.Info.SubCellOffsets[mobile.fromSubCell];
|
||||
var toSubcellOffset = mobile.Info.SubCellOffsets[mobile.toSubCell];
|
||||
var fromSubcellOffset = MobileInfo.SubCellOffsets[mobile.fromSubCell];
|
||||
var toSubcellOffset = MobileInfo.SubCellOffsets[mobile.toSubCell];
|
||||
|
||||
var nextCell = parent.PopPath( self, mobile );
|
||||
if( nextCell != null )
|
||||
{
|
||||
if(IsTurn(mobile, nextCell.Value.First))
|
||||
{
|
||||
var nextSubcellOffset = mobile.Info.SubCellOffsets[nextCell.Value.Second];
|
||||
var nextSubcellOffset = MobileInfo.SubCellOffsets[nextCell.Value.Second];
|
||||
var ret = new MoveFirstHalf(
|
||||
move,
|
||||
Util.BetweenCells( mobile.fromCell, mobile.toCell ) + (fromSubcellOffset + toSubcellOffset) / 2,
|
||||
|
||||
Reference in New Issue
Block a user