summaryrefslogtreecommitdiff
path: root/src/resources
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
parentca0ca278d0c4aed9a6d50bb9a8982f5261151ab8 (diff)
downloadmv-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.gz
mv-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.bz2
mv-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.xz
mv-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.zip
Add enum for item types.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/inventory/complexinventory.cpp2
-rw-r--r--src/resources/inventory/complexinventory.h2
-rw-r--r--src/resources/inventory/inventory.cpp32
-rw-r--r--src/resources/inventory/inventory.h6
-rw-r--r--src/resources/item/complexitem.cpp2
-rw-r--r--src/resources/item/complexitem.h2
-rw-r--r--src/resources/item/item.cpp2
-rw-r--r--src/resources/item/item.h12
-rw-r--r--src/resources/item/shopitem.cpp4
-rw-r--r--src/resources/item/shopitem.h4
10 files changed, 45 insertions, 23 deletions
diff --git a/src/resources/inventory/complexinventory.cpp b/src/resources/inventory/complexinventory.cpp
index 60f6092e6..724b89762 100644
--- a/src/resources/inventory/complexinventory.cpp
+++ b/src/resources/inventory/complexinventory.cpp
@@ -116,7 +116,7 @@ bool ComplexInventory::addVirtualItem(const Item *const item,
void ComplexInventory::setItem(const int index,
const int id,
- const int type,
+ const ItemTypeT type,
const int quantity,
const uint8_t refine,
const ItemColor color,
diff --git a/src/resources/inventory/complexinventory.h b/src/resources/inventory/complexinventory.h
index 95183cb7f..996212d18 100644
--- a/src/resources/inventory/complexinventory.h
+++ b/src/resources/inventory/complexinventory.h
@@ -51,7 +51,7 @@ class ComplexInventory final : public Inventory
void setItem(const int index,
const int id,
- const int type,
+ const ItemTypeT type,
const int quantity,
const uint8_t refine,
const ItemColor color,
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++;
diff --git a/src/resources/inventory/inventory.h b/src/resources/inventory/inventory.h
index 9186fbd73..f687339cb 100644
--- a/src/resources/inventory/inventory.h
+++ b/src/resources/inventory/inventory.h
@@ -25,6 +25,8 @@
#include "enums/inventorytype.h"
+#include "enums/resources/itemtype.h"
+
#include "enums/simpletypes/beingtypeid.h"
#include "enums/simpletypes/damaged.h"
#include "enums/simpletypes/equipm.h"
@@ -90,7 +92,7 @@ class Inventory notfinal
* Adds a new item in a free slot.
*/
int addItem(const int id,
- const int type,
+ const ItemTypeT type,
const int quantity,
const uint8_t refine,
const ItemColor color,
@@ -105,7 +107,7 @@ class Inventory notfinal
*/
virtual void setItem(const int index,
const int id,
- const int type,
+ const ItemTypeT type,
const int quantity,
const uint8_t refine,
const ItemColor color,
diff --git a/src/resources/item/complexitem.cpp b/src/resources/item/complexitem.cpp
index 3d50d62e5..ecb4edb9e 100644
--- a/src/resources/item/complexitem.cpp
+++ b/src/resources/item/complexitem.cpp
@@ -25,7 +25,7 @@
#include "debug.h"
ComplexItem::ComplexItem(const int id,
- const int type,
+ const ItemTypeT type,
const int quantity,
const uint8_t refine,
const ItemColor color,
diff --git a/src/resources/item/complexitem.h b/src/resources/item/complexitem.h
index b567c49e8..aae9130fc 100644
--- a/src/resources/item/complexitem.h
+++ b/src/resources/item/complexitem.h
@@ -35,7 +35,7 @@ class ComplexItem final : public Item
* Constructor.
*/
ComplexItem(const int id,
- const int type,
+ const ItemTypeT type,
const int quantity,
const uint8_t refine,
const ItemColor color,
diff --git a/src/resources/item/item.cpp b/src/resources/item/item.cpp
index 044e11fdb..f6d0af1d9 100644
--- a/src/resources/item/item.cpp
+++ b/src/resources/item/item.cpp
@@ -38,7 +38,7 @@
DragDrop dragDrop(nullptr, DragDropSource::Empty);
Item::Item(const int id,
- const int type,
+ const ItemTypeT type,
const int quantity,
const uint8_t refine,
const ItemColor color,
diff --git a/src/resources/item/item.h b/src/resources/item/item.h
index 9a910c31b..d0bb9b9f3 100644
--- a/src/resources/item/item.h
+++ b/src/resources/item/item.h
@@ -25,6 +25,8 @@
#include "const/resources/item/cards.h"
+#include "enums/resources/itemtype.h"
+
#include "enums/simpletypes/damaged.h"
#include "enums/simpletypes/equipm.h"
#include "enums/simpletypes/equipped.h"
@@ -48,7 +50,7 @@ class Item notfinal
* Constructor.
*/
Item(const int id,
- const int type,
+ const ItemTypeT type,
const int quantity,
const uint8_t refine,
const ItemColor color,
@@ -209,10 +211,10 @@ class Item notfinal
const int *getCards() const
{ return mCards; }
- void setType(const int type)
+ void setType(const ItemTypeT type)
{ mType = type; }
- int getType() const A_WARN_UNUSED
+ ItemTypeT getType() const A_WARN_UNUSED
{ return mType; }
void setTag(const int tag)
@@ -225,7 +227,7 @@ class Item notfinal
void updateColor();
- int mId; /**< Item type id. */
+ int mId; /**< Item id. */
ItemColor mColor;
int mQuantity; /**< Number of items. */
int mTag;
@@ -237,7 +239,7 @@ class Item notfinal
int mCards[maxCards];
uint8_t mRefine; /**< Item refine level. */
int mInvIndex; /**< Inventory index. */
- int mType; /**< Item type. */
+ ItemTypeT mType; /**< Item type. */
Equipm mEquipment; /**< Item is equipment. */
Equipped mEquipped; /**< Item is equipped. */
bool mInEquipment; /**< Item is in equipment */
diff --git a/src/resources/item/shopitem.cpp b/src/resources/item/shopitem.cpp
index f8e837c86..1f70076b9 100644
--- a/src/resources/item/shopitem.cpp
+++ b/src/resources/item/shopitem.cpp
@@ -34,7 +34,7 @@
ShopItem::ShopItem(const int inventoryIndex,
const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int quantity,
const int price) :
@@ -58,7 +58,7 @@ ShopItem::ShopItem(const int inventoryIndex,
}
ShopItem::ShopItem(const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int price) :
Item(id, type, 0, 0, color,
diff --git a/src/resources/item/shopitem.h b/src/resources/item/shopitem.h
index 6c4d3f886..bf966aeb7 100644
--- a/src/resources/item/shopitem.h
+++ b/src/resources/item/shopitem.h
@@ -46,7 +46,7 @@ class ShopItem final : public Item
*/
ShopItem(const int inventoryIndex,
const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int quantity,
const int price);
@@ -59,7 +59,7 @@ class ShopItem final : public Item
* @param price price of the item
*/
ShopItem(const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int price);