- // Adds an item to a suitable place. Returns false if failed.
- bool addItem(InventoryItem *newitem);
- // If possible, adds item to given slot. Returns true on success.
- // Fails when slot is populated by a different kind of item.
- bool addItem(u32 i, InventoryItem *newitem);
+
+ // Adds an item to a suitable place. Returns leftover item.
+ // If all went into the list, returns NULL.
+ InventoryItem * addItem(InventoryItem *newitem);
+
+ // If possible, adds item to given slot.
+ // If cannot be added at all, returns the item back.
+ // If can be added partly, decremented item is returned back.
+ // If can be added fully, NULL is returned.
+ InventoryItem * addItem(u32 i, InventoryItem *newitem);
+
+ // Checks whether the item could be added to the given slot
+ bool itemFits(const u32 i, const InventoryItem *newitem);
+
+ // Checks whether there is room for a given item
+ bool roomForItem(const InventoryItem *item);
+
+ // Checks whether there is room for a given item aftr it has been cooked
+ bool roomForCookedItem(const InventoryItem *item);
+
+ // Takes some items from a slot.
+ // If there are not enough, takes as many as it can.
+ // Returns NULL if couldn't take any.
+ InventoryItem * takeItem(u32 i, u32 count);