diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-24 23:29:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-24 23:29:04 +0300 |
commit | 4e97da8e138b21a5f5bea75e6a8d3211e4f28594 (patch) | |
tree | c10d3cad963066a908ebd42041723e110a0c9bf0 /src/gui/windows | |
parent | ca0ca278d0c4aed9a6d50bb9a8982f5261151ab8 (diff) | |
download | manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.gz manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.bz2 manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.tar.xz manaverse-4e97da8e138b21a5f5bea75e6a8d3211e4f28594.zip |
Add enum for item types.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/buydialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/windows/buydialog.h | 4 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/itemamountwindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/shopwindow.cpp | 29 | ||||
-rw-r--r-- | src/gui/windows/tradewindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/tradewindow.h | 9 |
7 files changed, 46 insertions, 16 deletions
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; /** |