diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-02-23 16:02:00 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-02-23 16:02:00 +0000 |
commit | 05a12d5568111fa13759026442ed358605bf9a28 (patch) | |
tree | 9948a2351c846dee1b36f25a90d1429aa78dda23 /src/inventory.cpp | |
parent | 3737fb9fd3ff6072f83bdc514f88ad0fdbf4da6c (diff) | |
download | mana-05a12d5568111fa13759026442ed358605bf9a28.tar.gz mana-05a12d5568111fa13759026442ed358605bf9a28.tar.bz2 mana-05a12d5568111fa13759026442ed358605bf9a28.tar.xz mana-05a12d5568111fa13759026442ed358605bf9a28.zip |
A bunch of mostly cosmetic cleanups.
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r-- | src/inventory.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index 6cfcb921..65f21292 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -27,15 +27,15 @@ Inventory::Inventory() { - items = new Item[INVENTORY_SIZE]; + mItems = new Item[INVENTORY_SIZE]; for (int i = 0; i < INVENTORY_SIZE; i++) { - items[i].setInvIndex(i); + mItems[i].setInvIndex(i); } } Inventory::~Inventory() { - delete [] items; + delete [] mItems; } Item* Inventory::getItem(int index) @@ -45,7 +45,7 @@ Item* Inventory::getItem(int index) return 0; } - return &items[index]; + return &mItems[index]; } void Inventory::addItem(int id, int quantity, bool equipment) @@ -55,27 +55,27 @@ void Inventory::addItem(int id, int quantity, bool equipment) void Inventory::addItem(int index, int id, int quantity, bool equipment) { - items[index].setId(id); - items[index].increaseQuantity(quantity); - items[index].setEquipment(equipment); + mItems[index].setId(id); + mItems[index].increaseQuantity(quantity); + mItems[index].setEquipment(equipment); } void Inventory::clear() { for (int i = 0; i < INVENTORY_SIZE; i++) { - items[i].setId(-1); - items[i].setQuantity(0); - items[i].setEquipped(false); + mItems[i].setId(-1); + mItems[i].setQuantity(0); + mItems[i].setEquipped(false); } } void Inventory::removeItem(int id) { for (int i = 0; i < INVENTORY_SIZE; i++) { - if (items[i].getId() == id) { - items[i].setId(-1); - items[i].setQuantity(0); + if (mItems[i].getId() == id) { + mItems[i].setId(-1); + mItems[i].setQuantity(0); } } } @@ -83,7 +83,7 @@ void Inventory::removeItem(int id) bool Inventory::contains(Item *item) { for (int i = 0; i < INVENTORY_SIZE; i++) { - if (items[i].getId() == item->getId()) { + if (mItems[i].getId() == item->getId()) { return true; } } @@ -94,7 +94,7 @@ bool Inventory::contains(Item *item) int Inventory::getFreeSlot() { for (int i = 2; i < INVENTORY_SIZE; i++) { - if (items[i].getId() == -1) { + if (mItems[i].getId() == -1) { return i; } } @@ -103,16 +103,16 @@ int Inventory::getFreeSlot() int Inventory::getNumberOfSlotsUsed() { - int NumberOfFilledSlot = 0; + int numberOfFilledSlot = 0; for (int i = 0; i < INVENTORY_SIZE; i++) { - if (items[i].getId() > -1 || items[i].getQuantity() > 0) + if (mItems[i].getId() > -1 || mItems[i].getQuantity() > 0) { - NumberOfFilledSlot++; + numberOfFilledSlot++; } } - return NumberOfFilledSlot; + return numberOfFilledSlot; } int Inventory::getLastUsedSlot() @@ -120,7 +120,7 @@ int Inventory::getLastUsedSlot() int i; for (i = INVENTORY_SIZE - 1; i >= 0; i--) { - if ((items[i].getId() != -1) && (items[i].getQuantity() > 0)) { + if ((mItems[i].getId() != -1) && (mItems[i].getQuantity() > 0)) { break; } } |