Mooege.Core.GS.Common.InventoryGrid.FindSlotForItem C# (CSharp) Method

FindSlotForItem() private method

Find an inventory slot with enough space for an item
private FindSlotForItem ( Item item ) : InventorySlot?
item Item
return InventorySlot?
        private InventorySlot? FindSlotForItem(Item item)
        {
            InventorySize size = GetItemInventorySize(item);
            for (int r = 0; r <= Rows - size.Height; r++)
                for (int c = 0; c <= Columns - size.Width; c++)
                    if (CollectOverlappingItems(item, r, c) == 0)
                        return new InventorySlot() { Row = r, Column = c };
            return null;
        }