Don’t crash when asking for the offset of an invalid subcell.

This commit is contained in:
Paul Chote
2015-04-19 15:10:17 +12:00
parent 9df371b393
commit ab7706073b

View File

@@ -190,7 +190,13 @@ namespace OpenRA
public Bitmap CustomPreview;
public bool InvalidCustomRules { get; private set; }
public WVec OffsetOfSubCell(SubCell subCell) { return SubCellOffsets[(int)subCell]; }
public WVec OffsetOfSubCell(SubCell subCell)
{
if (subCell == SubCell.Invalid || subCell == SubCell.Any)
return WVec.Zero;
return SubCellOffsets[(int)subCell];
}
[FieldLoader.LoadUsing("LoadOptions")] public MapOptions Options;