Fix SubCell indexing in Map.CenterOfSubCell and MapGrid.OffsetOfSubCell
This commit is contained in:
@@ -786,7 +786,7 @@ namespace OpenRA
|
||||
public WPos CenterOfSubCell(CPos cell, SubCell subCell)
|
||||
{
|
||||
var index = (int)subCell;
|
||||
if (index >= 0 && index <= Grid.SubCellOffsets.Length)
|
||||
if (index >= 0 && index < Grid.SubCellOffsets.Length)
|
||||
return CenterOfCell(cell) + Grid.SubCellOffsets[index];
|
||||
return CenterOfCell(cell);
|
||||
}
|
||||
|
||||
@@ -168,7 +168,11 @@ namespace OpenRA
|
||||
if (subCell == SubCell.Invalid || subCell == SubCell.Any)
|
||||
return WVec.Zero;
|
||||
|
||||
return SubCellOffsets[(int)subCell];
|
||||
var index = (int)subCell;
|
||||
if (index >= 0 && index < SubCellOffsets.Length)
|
||||
return SubCellOffsets[index];
|
||||
|
||||
return WVec.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user