summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-13 12:49:52 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-13 12:49:52 +0000
commit10b881f997384378a299bff358716db5183b65a5 (patch)
tree2231d834a69c1db68980c1ccefdc6586df351fc0 /src/inventory.cpp
parentda5a71f65682dbb3f830be4d5ffcd0046aa7b7ce (diff)
downloadmana-10b881f997384378a299bff358716db5183b65a5.tar.gz
mana-10b881f997384378a299bff358716db5183b65a5.tar.bz2
mana-10b881f997384378a299bff358716db5183b65a5.tar.xz
mana-10b881f997384378a299bff358716db5183b65a5.zip
Huge header cleanup to reduce dependencies and compile time.
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 30763622..9e3ad375 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -24,10 +24,12 @@
#include "inventory.h"
#include "equipment.h"
+#include "item.h"
#include "net/network.h"
Inventory::Inventory()
{
+ items = new Item[INVENTORY_SIZE];
for (int i = 0; i < INVENTORY_SIZE; i++) {
items[i].setInvIndex(i);
}
@@ -35,8 +37,27 @@ Inventory::Inventory()
Inventory::~Inventory()
{
+ delete [] items;
}
+Item* Inventory::getItem(int index)
+{
+ return &items[index];
+}
+
+void Inventory::addItem(int id, int quantity, bool equipment)
+{
+ addItem(getFreeSlot(), id, quantity, equipment);
+}
+
+void Inventory::addItem(int index, int id, int quantity, bool equipment)
+{
+ items[index].setId(id);
+ items[index].increaseQuantity(quantity);
+ items[index].setEquipment(equipment);
+}
+
+
void Inventory::resetItems()
{
for (int i = 0; i < INVENTORY_SIZE; i++) {