Merge pull request #11290 from Mailaender/d2k-shellmap-editor-crash

Fixed a crash when loading the Dune 2000 shellmap in the map editor
This commit is contained in:
abcdefg30
2016-05-23 01:11:34 +02:00
5 changed files with 11 additions and 27 deletions

View File

@@ -31,22 +31,22 @@ namespace OpenRA.Primitives
itemBoundsBins = Exts.MakeArray(rows * cols, _ => new Dictionary<T, Rectangle>());
}
void ValidateBounds(Rectangle bounds)
void ValidateBounds(T actor, Rectangle bounds)
{
if (bounds.Width == 0 || bounds.Height == 0)
throw new ArgumentException("bounds must be non-empty.", "bounds");
throw new ArgumentException("Bounds of actor {0} are empty.".F(actor), "bounds");
}
public void Add(T item, Rectangle bounds)
{
ValidateBounds(bounds);
ValidateBounds(item, bounds);
itemBounds.Add(item, bounds);
MutateBins(item, bounds, addItem);
}
public void Update(T item, Rectangle bounds)
{
ValidateBounds(bounds);
ValidateBounds(item, bounds);
MutateBins(item, itemBounds[item], removeItem);
MutateBins(item, itemBounds[item] = bounds, addItem);
}