summaryrefslogtreecommitdiff
path: root/src/gui
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/gui
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/gui')
-rw-r--r--src/gui/models/shopitems.cpp6
-rw-r--r--src/gui/models/shopitems.h8
-rw-r--r--src/gui/widgets/selldialog.cpp2
-rw-r--r--src/gui/widgets/selldialog.h7
-rw-r--r--src/gui/windows/buydialog.cpp8
-rw-r--r--src/gui/windows/buydialog.h4
-rw-r--r--src/gui/windows/inventorywindow.cpp3
-rw-r--r--src/gui/windows/itemamountwindow.cpp5
-rw-r--r--src/gui/windows/shopwindow.cpp29
-rw-r--r--src/gui/windows/tradewindow.cpp4
-rw-r--r--src/gui/windows/tradewindow.h9
11 files changed, 60 insertions, 25 deletions
diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp
index 2a2b75ae8..c25664cdd 100644
--- a/src/gui/models/shopitems.cpp
+++ b/src/gui/models/shopitems.cpp
@@ -52,7 +52,7 @@ std::string ShopItems::getElementAt(int i)
}
ShopItem *ShopItems::addItem(const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int amount,
const int price)
@@ -64,7 +64,7 @@ ShopItem *ShopItems::addItem(const int id,
}
ShopItem *ShopItems::addItemNoDup(const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int amount,
const int price)
@@ -81,7 +81,7 @@ ShopItem *ShopItems::addItemNoDup(const int id,
ShopItem *ShopItems::addItem2(const int inventoryIndex,
const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int quantity,
const int price)
diff --git a/src/gui/models/shopitems.h b/src/gui/models/shopitems.h
index d346c38b7..0aedce83f 100644
--- a/src/gui/models/shopitems.h
+++ b/src/gui/models/shopitems.h
@@ -23,6 +23,8 @@
#ifndef GUI_MODELS_SHOPITEMS_H
#define GUI_MODELS_SHOPITEMS_H
+#include "enums/resources/itemtype.h"
+
#include "enums/simpletypes/itemcolor.h"
#include "gui/models/listmodel.h"
@@ -61,7 +63,7 @@ class ShopItems final : public ListModel
* Adds an item to the list.
*/
ShopItem *addItem(const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int amount,
const int price);
@@ -77,13 +79,13 @@ class ShopItems final : public ListModel
*/
ShopItem *addItem2(const int inventoryIndex,
const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int amount,
const int price);
ShopItem *addItemNoDup(const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int amount,
const int price);
diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp
index 17664ed78..c0b7fdd24 100644
--- a/src/gui/widgets/selldialog.cpp
+++ b/src/gui/widgets/selldialog.cpp
@@ -221,7 +221,7 @@ void SellDialog::addItem(const Item *const item, const int price)
}
ShopItem *SellDialog::addItem(const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int amount,
const int price)
diff --git a/src/gui/widgets/selldialog.h b/src/gui/widgets/selldialog.h
index 2918055c9..46512225f 100644
--- a/src/gui/widgets/selldialog.h
+++ b/src/gui/widgets/selldialog.h
@@ -23,6 +23,8 @@
#ifndef GUI_WIDGETS_SELLDIALOG_H
#define GUI_WIDGETS_SELLDIALOG_H
+#include "enums/resources/itemtype.h"
+
#include "enums/simpletypes/advanced.h"
#include "enums/simpletypes/issell.h"
#include "enums/simpletypes/itemcolor.h"
@@ -72,7 +74,8 @@ class SellDialog notfinal : public Window,
/**
* Adds an item to the inventory.
*/
- void addItem(const Item *const item, const int price);
+ void addItem(const Item *const item,
+ const int price);
/**
* Called when receiving actions from the widgets.
@@ -97,7 +100,7 @@ class SellDialog notfinal : public Window,
void setVisible(Visible visible) override final;
ShopItem *addItem(const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int amount,
const int price);
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index b0cf5bc8c..fa7297bdd 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -390,12 +390,16 @@ void BuyDialog::reset()
}
ShopItem *BuyDialog::addItem(const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int amount,
const int price)
{
- ShopItem *const item = mShopItems->addItem(id, type, color, amount, price);
+ ShopItem *const item = mShopItems->addItem(id,
+ type,
+ color,
+ amount,
+ price);
mShopItemList->adjustSize();
return item;
}
diff --git a/src/gui/windows/buydialog.h b/src/gui/windows/buydialog.h
index 3249eae2a..77d5c357f 100644
--- a/src/gui/windows/buydialog.h
+++ b/src/gui/windows/buydialog.h
@@ -23,6 +23,8 @@
#ifndef GUI_WINDOWS_BUYDIALOG_H
#define GUI_WINDOWS_BUYDIALOG_H
+#include "enums/resources/itemtype.h"
+
#include "enums/simpletypes/beingid.h"
#include "enums/simpletypes/itemcolor.h"
@@ -105,7 +107,7 @@ class BuyDialog final : public Window,
* Adds an item to the shop inventory.
*/
ShopItem *addItem(const int id,
- const int type,
+ const ItemTypeT type,
const ItemColor color,
const int amount,
const int price);
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index 5485bd98a..db256b4a1 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -1047,8 +1047,7 @@ void InventoryWindow::combineItems(const int index1,
if (!item2)
return;
- // IT_CARD
- if (item1->getType() != 6)
+ if (item1->getType() != ItemType::Card)
{
const Item *tmpItem = item1;
item1 = item2;
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index 8ad79ecab..02c94931e 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -388,7 +388,10 @@ void ItemAmountWindow::action(const ActionEvent &event)
const int id = ItemDB::get(mItemsModal->getElementAt(
mItemDropDown->getSelected())).getId();
- mItem = new Item(id, 0, 10000, 0,
+ mItem = new Item(id,
+ ItemType::Unknown,
+ 10000,
+ 0,
ItemColor_one,
Identified_true,
Damaged_true,
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 679bbc47f..eb07c90dc 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -562,12 +562,20 @@ void ShopWindow::loadList()
if (tokens[1] && tokens[2])
{
mBuyShopItems->addItem(
- tokens[0], 0, ItemColor_one, tokens[1], tokens[2]);
+ tokens[0],
+ ItemType::Unknown,
+ ItemColor_one,
+ tokens[1],
+ tokens[2]);
}
if (tokens[3] && tokens[4])
{
mSellShopItems->addItem(
- tokens[0], 0, ItemColor_one, tokens[3], tokens[4]);
+ tokens[0],
+ ItemType::Unknown,
+ ItemColor_one,
+ tokens[3],
+ tokens[4]);
}
}
}
@@ -855,7 +863,13 @@ void ShopWindow::showList(const std::string &nick, std::string data)
int amount = decodeStr(data.substr(f + 6, 3));
// +++ need impliment colors?
if (buyDialog && amount > 0)
- buyDialog->addItem(id, 0, ItemColor_one, amount, price);
+ {
+ buyDialog->addItem(id,
+ ItemType::Unknown,
+ ItemColor_one,
+ amount,
+ price);
+ }
if (sellDialog)
{
// +++ need support for colors
@@ -870,7 +884,7 @@ void ShopWindow::showList(const std::string &nick, std::string data)
amount = 0;
}
ShopItem *const shopItem = sellDialog->addItem(id,
- 0,
+ ItemType::Unknown,
ItemColor_one,
amount,
price);
@@ -940,7 +954,12 @@ void ShopWindow::processRequest(const std::string &nick, std::string data,
delete mTradeItem;
// +++ need impliment colors?
- mTradeItem = new ShopItem(-1, id, 0, ItemColor_one, amount, price);
+ mTradeItem = new ShopItem(-1,
+ id,
+ ItemType::Unknown,
+ ItemColor_one,
+ amount,
+ price);
if (mode == BUY)
{
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index fe0ca85f1..e251b0bd9 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -195,7 +195,7 @@ void TradeWindow::setMoney(const int amount)
}
void TradeWindow::addItem(const int id,
- const int type,
+ const ItemTypeT type,
const bool own,
const int quantity,
const uint8_t refine,
@@ -218,7 +218,7 @@ void TradeWindow::addItem(const int id,
}
void TradeWindow::addItem2(const int id,
- const int type,
+ const ItemTypeT type,
const int *const cards,
const int sz,
const bool own,
diff --git a/src/gui/windows/tradewindow.h b/src/gui/windows/tradewindow.h
index 98b18ba7e..f8a280a20 100644
--- a/src/gui/windows/tradewindow.h
+++ b/src/gui/windows/tradewindow.h
@@ -25,6 +25,8 @@
#include "gui/widgets/window.h"
+#include "enums/resources/itemtype.h"
+
#include "enums/simpletypes/damaged.h"
#include "enums/simpletypes/equipm.h"
#include "enums/simpletypes/favorite.h"
@@ -72,7 +74,7 @@ class TradeWindow final : public Window,
* Add an item to the trade window.
*/
void addItem(const int id,
- const int type,
+ const ItemTypeT type,
const bool own,
const int quantity,
const uint8_t refine,
@@ -90,7 +92,7 @@ class TradeWindow final : public Window,
* Add an item to the trade window.
*/
void addItem2(const int id,
- const int type,
+ const ItemTypeT type,
const int *const cards,
const int sz,
const bool own,
@@ -122,7 +124,8 @@ class TradeWindow final : public Window,
/**
* Send trade packet.
*/
- void tradeItem(const Item *const item, const int quantity,
+ void tradeItem(const Item *const item,
+ const int quantity,
const bool check = false) const;
/**