diff options
Diffstat (limited to 'src/inventory.h')
-rw-r--r-- | src/inventory.h | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/inventory.h b/src/inventory.h index 90d9c7a2..d2a81edf 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -1,21 +1,21 @@ /* * The Mana World - * Copyright 2004 The Mana World Development Team + * Copyright (C) 2004 The Mana World Development Team * * This file is part of The Mana World. * - * The Mana World is free software; you can redistribute it and/or modify + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * - * The Mana World is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -24,15 +24,13 @@ class Item; -#define INVENTORY_SIZE 50 - class Inventory { public: /** * Constructor. */ - Inventory(); + Inventory(int size); /** * Destructor. @@ -40,19 +38,32 @@ class Inventory ~Inventory(); /** + * Returns the size that this instance is configured for + */ + int getSize() { return mSize; } + + /** * Returns the item at the specified index. */ Item* getItem(int index) const; /** + * Searches for the specified item by it's id. + * + * @param itemId The id of the item to be searched. + * @return Item found on success, NULL on failure. + */ + Item* findItem(int itemId) const; + + /** * Adds a new item in a free slot. */ - void addItem(int id, int quantity); + void addItem(int id, int quantity, bool equipment = false); /** * Sets the item at the given position. */ - void setItem(int index, int id, int quantity); + void setItem(int index, int id, int quantity, bool equipment = false); /** * Remove a item from the inventory. @@ -60,9 +71,9 @@ class Inventory void removeItem(int id); /** - * Remove a item from the inventory, specified by the index. + * Remove the item at the specified index from the inventory. */ - void removeItemIndex(int index); + void removeItemAt(int index); /** * Checks if the given item is in the inventory @@ -92,6 +103,7 @@ class Inventory static const int NO_SLOT_INDEX = -1; /**< Slot has no index. */ protected: Item **mItems; /**< The holder of items */ + int mSize; /**< The max number of inventory items */ }; #endif |