summaryrefslogtreecommitdiff
path: root/src/resources/inventory/inventory.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-24 23:29:04 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-24 23:29:04 +0300
commit4e97da8e138b21a5f5bea75e6a8d3211e4f28594 (patch)
treec10d3cad963066a908ebd42041723e110a0c9bf0 /src/resources/inventory/inventory.cpp
parentca0ca278d0c4aed9a6d50bb9a8982f5261151ab8 (diff)
downloadmanaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.gz
manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.bz2
manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.xz
manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.zip
Add enum for item types.
Diffstat (limited to 'src/resources/inventory/inventory.cpp')
-rw-r--r--src/resources/inventory/inventory.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/resources/inventory/inventory.cpp b/src/resources/inventory/inventory.cpp
index 7d78605dc..d732874be 100644
--- a/src/resources/inventory/inventory.cpp
+++ b/src/resources/inventory/inventory.cpp
@@ -54,7 +54,8 @@ namespace
};
} // namespace
-Inventory::Inventory(const InventoryTypeT type, const int size1) :
+Inventory::Inventory(const InventoryTypeT type,
+ const int size1) :
mInventoryListeners(),
mVirtualRemove(),
mType(type),
@@ -109,7 +110,7 @@ Item *Inventory::findItem(const int itemId,
}
int Inventory::addItem(const int id,
- const int type,
+ const ItemTypeT type,
const int quantity,
const uint8_t refine,
const ItemColor color,
@@ -120,14 +121,23 @@ int Inventory::addItem(const int id,
const Equipped equipped)
{
const int slot = getFreeSlot();
- setItem(slot, id, type, quantity, refine, color,
- identified, damaged, favorite, equipment, equipped);
+ setItem(slot,
+ id,
+ type,
+ quantity,
+ refine,
+ color,
+ identified,
+ damaged,
+ favorite,
+ equipment,
+ equipped);
return slot;
}
void Inventory::setItem(const int index,
const int id,
- const int type,
+ const ItemTypeT type,
const int quantity,
const uint8_t refine,
const ItemColor color,
@@ -146,8 +156,16 @@ void Inventory::setItem(const int index,
Item *const item1 = mItems[index];
if (!item1 && id > 0)
{
- Item *const item = new Item(id, type, quantity, refine, color,
- identified, damaged, favorite, equipment, equipped);
+ Item *const item = new Item(id,
+ type,
+ quantity,
+ refine,
+ color,
+ identified,
+ damaged,
+ favorite,
+ equipment,
+ equipped);
item->setInvIndex(index);
mItems[index] = item;
mUsed++;