Merge pull request #7976 from pchote/subcell-crash

Don’t crash when asking for the offset of an invalid subcell.
This commit is contained in:
Pavel Penev
2015-04-19 13:40:47 +03:00

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;