From 5cbd0d2cb7086fda592c00dbc3b07d06af95f080 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 30 Aug 2012 22:53:27 +0300 Subject: Add const to more classes. --- src/inventory.h | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/inventory.h') diff --git a/src/inventory.h b/src/inventory.h index 6cfcc3f86..f7d3e448f 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -64,7 +64,7 @@ class Inventory * * @param size the number of items that fit in the inventory */ - Inventory(int type, int size = -1); + Inventory(const int type, const int size = -1); /** * Destructor. @@ -80,7 +80,7 @@ class Inventory /** * Returns the item at the specified index. */ - Item *getItem(int index) const; + Item *getItem(const int index) const; /** * Searches for the specified item by it's id. @@ -89,34 +89,35 @@ class Inventory * @param color The color of the item to be searched. * @return Item found on success, NULL on failure. */ - Item *findItem(int itemId, unsigned char color) const; + Item *findItem(const int itemId, const unsigned char color) const; /** * Adds a new item in a free slot. */ - void addItem(int id, int quantity, int refine, unsigned char color, - bool equipment = false); + void addItem(const int id, const int quantity, const int refine, + const unsigned char color, bool equipment = false); /** * Sets the item at the given position. */ - void setItem(int index, int id, int quantity, int refine, - unsigned char color, bool equipment = false); + void setItem(const int index, const int id, const int quantity, + const int refine, const unsigned char color, + const bool equipment = false); /** * Remove a item from the inventory. */ - void removeItem(int id); + void removeItem(const int id); /** * Remove the item at the specified index from the inventory. */ - void removeItemAt(int index); + void removeItemAt(const int index); /** * Checks if the given item is in the inventory. */ - bool contains(Item *item) const; + bool contains(const Item *const item) const; /** * Returns id of next free slot or -1 if all occupied. @@ -139,9 +140,9 @@ class Inventory */ int getLastUsedSlot() const; - void addInventoyListener(InventoryListener* listener); + void addInventoyListener(InventoryListener *const listener); - void removeInventoyListener(InventoryListener* listener); + void removeInventoyListener(InventoryListener *const listener); int getType() const { return mType; } @@ -150,9 +151,9 @@ class Inventory { return mType == INVENTORY; } Item *findItemBySprite(std::string spritePath, - Gender gender, int race); + const Gender gender, const int race) const; - std::string getName(); + std::string getName() const; protected: typedef std::list InventoryListenerList; -- cgit v1.2.3-60-g2f50