public int InsertItem(TycoonItem item, int quantity) { List<TycoonInventorySlot> slotList = new List<TycoonInventorySlot>(); if (mItemDictionary.ContainsKey(item)) { slotList = mItemDictionary[item]; } else { mItemDictionary.Add(item, new List<TycoonInventorySlot>()); slotList = mItemDictionary[item]; } foreach(TycoonInventorySlot slot in slotList) { quantity = slot.AddQuantity(quantity); } while(quantity > 0 && GetNumberOfActiveSlots < GetMaxNumberOfSlots) { TycoonInventorySlot newSlot = new TycoonInventorySlot(); slotList.Add(newSlot); newSlot.Item = item; quantity = newSlot.AddQuantity(quantity); } return quantity; }
public bool CheckForSpace(TycoonItem item, int quantity) { if (mItemDictionary.ContainsKey(item)) { //int stacks = (mItemDictionary[item].Quantity + quantity) / item.StackSize; } return true; }