private int CollectOverlappingItems(Item item, int row, int column)
{
InventorySize dropSize = GetItemInventorySize(item);
var overlapping = new List<uint>();
// For every slot...
for (int r = row; r < _backpack.GetLength(0) && r < row + dropSize.Height; r++)
for (int c = column; c < _backpack.GetLength(1) && c < column + dropSize.Width; c++)
// that contains an item other than the one we want to drop
if (_backpack[r, c] != 0 && _backpack[r, c] != item.DynamicID) //TODO this would break for an item with id 0
// add it to the list if if dropping the item in <row, column> would need the same slot
//if (r >= row && r <= row + dropSize.Height)
// if (c >= column && c <= column + dropSize.Width)
if (!overlapping.Contains(_backpack[r, c]))
overlapping.Add(_backpack[r, c]);
return overlapping.Count;
}