+ const std::string &getName() const;
+ u32 getSize() const;
+ u32 getWidth() const;
+ // Count used slots
+ u32 getUsedSlots() const;
+ u32 getFreeSlots() const;
+
+ // Get reference to item
+ const ItemStack& getItem(u32 i) const;
+ ItemStack& getItem(u32 i);
+ // Returns old item. Parameter can be an empty item.
+ ItemStack changeItem(u32 i, const ItemStack &newitem);
+ // Delete item
+ void deleteItem(u32 i);
+
+ // Adds an item to a suitable place. Returns leftover item (possibly empty).
+ ItemStack addItem(const ItemStack &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, empty item is returned.
+ ItemStack addItem(u32 i, const ItemStack &newitem);
+
+ // Checks whether the item could be added to the given slot
+ // If restitem is non-NULL, it receives the part of newitem that
+ // would be left over after adding.
+ bool itemFits(const u32 i, const ItemStack &newitem,
+ ItemStack *restitem = NULL) const;
+
+ // Checks whether there is room for a given item
+ bool roomForItem(const ItemStack &item) const;
+
+ // Checks whether the given count of the given item name
+ // exists in this inventory list.
+ bool containsItem(const ItemStack &item) const;
+
+ // Removes the given count of the given item name from
+ // this inventory list. Walks the list in reverse order.
+ // If not as many items exist as requested, removes as
+ // many as possible.
+ // Returns the items that were actually removed.
+ ItemStack removeItem(const ItemStack &item);
+
+ // Takes some items from a slot.
+ // If there are not enough, takes as many as it can.
+ // Returns empty item if couldn't take any.
+ ItemStack takeItem(u32 i, u32 takecount);
+
+ // Similar to takeItem, but keeps the slot intact.
+ ItemStack peekItem(u32 i, u32 peekcount) const;
+
+ // Move an item to a different list (or a different stack in the same list)
+ // count is the maximum number of items to move (0 for everything)
+ void moveItem(u32 i, InventoryList *dest, u32 dest_i, u32 count = 0);