summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-15 13:58:32 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-16 01:52:14 +0300
commit41cc92f73e39cec5dfea6b1164176610cccc7df4 (patch)
tree22fd3d388084d2c61fe80f0441c3c30ab8ffd33c /src/gui
parent7aa637abc8b0bca35aacdb9492e65f557ed32038 (diff)
downloadManaVerse-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.gz
ManaVerse-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.bz2
ManaVerse-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.xz
ManaVerse-41cc92f73e39cec5dfea6b1164176610cccc7df4.zip
Add strong typed int for item color.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/models/shopitems.cpp9
-rw-r--r--src/gui/models/shopitems.h10
-rw-r--r--src/gui/popups/itempopup.cpp6
-rw-r--r--src/gui/popups/itempopup.h6
-rw-r--r--src/gui/popups/popupmenu.cpp19
-rw-r--r--src/gui/popups/popupmenu.h8
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp4
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp8
-rw-r--r--src/gui/widgets/selldialog.cpp2
-rw-r--r--src/gui/widgets/selldialog.h4
-rw-r--r--src/gui/widgets/virtshortcutcontainer.cpp4
-rw-r--r--src/gui/windows/buydialog.cpp5
-rw-r--r--src/gui/windows/buydialog.h3
-rw-r--r--src/gui/windows/buyingstoreselldialog.cpp2
-rw-r--r--src/gui/windows/charcreatedialog.cpp9
-rw-r--r--src/gui/windows/itemamountwindow.cpp3
-rw-r--r--src/gui/windows/maileditwindow.cpp3
-rw-r--r--src/gui/windows/mailviewwindow.cpp3
-rw-r--r--src/gui/windows/npcdialog.cpp4
-rw-r--r--src/gui/windows/outfitwindow.cpp11
-rw-r--r--src/gui/windows/outfitwindow.h4
-rw-r--r--src/gui/windows/shopwindow.cpp25
-rw-r--r--src/gui/windows/tradewindow.cpp4
-rw-r--r--src/gui/windows/tradewindow.h5
24 files changed, 94 insertions, 67 deletions
diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp
index 409ca3f63..05c4a5e6c 100644
--- a/src/gui/models/shopitems.cpp
+++ b/src/gui/models/shopitems.cpp
@@ -53,7 +53,7 @@ std::string ShopItems::getElementAt(int i)
ShopItem *ShopItems::addItem(const int id,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount,
const int price)
{
@@ -65,7 +65,7 @@ ShopItem *ShopItems::addItem(const int id,
ShopItem *ShopItems::addItemNoDup(const int id,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount,
const int price)
{
@@ -82,7 +82,7 @@ ShopItem *ShopItems::addItemNoDup(const int id,
ShopItem *ShopItems::addItem2(const int inventoryIndex,
const int id,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int quantity,
const int price)
{
@@ -155,7 +155,8 @@ void ShopItems::clear()
mShopItems.clear();
}
-ShopItem *ShopItems::findItem(const int id, const unsigned char color) const
+ShopItem *ShopItems::findItem(const int id,
+ const ItemColor color) const
{
std::vector<ShopItem*>::const_iterator it = mShopItems.begin();
const std::vector<ShopItem*>::const_iterator e = mShopItems.end();
diff --git a/src/gui/models/shopitems.h b/src/gui/models/shopitems.h
index b222f9385..c964bdfb9 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/simpletypes/itemcolor.h"
+
#include "gui/models/listmodel.h"
#include <vector>
@@ -60,7 +62,7 @@ class ShopItems final : public ListModel
*/
ShopItem *addItem(const int id,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount,
const int price);
@@ -76,13 +78,13 @@ class ShopItems final : public ListModel
ShopItem *addItem2(const int inventoryIndex,
const int id,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount,
const int price);
ShopItem *addItemNoDup(const int id,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount,
const int price);
@@ -145,7 +147,7 @@ class ShopItems final : public ListModel
* @return the item found or 0
*/
ShopItem *findItem(const int id,
- const unsigned char color) const A_WARN_UNUSED;
+ const ItemColor color) const A_WARN_UNUSED;
bool findInAllItems(std::vector<ShopItem*>::iterator &it,
const ShopItem *const item);
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp
index 33b2eba91..ceb32cdaf 100644
--- a/src/gui/popups/itempopup.cpp
+++ b/src/gui/popups/itempopup.cpp
@@ -58,7 +58,7 @@ ItemPopup::ItemPopup() :
mIcon(new Icon(this, nullptr)),
mLastName(),
mLastId(0),
- mLastColor(1)
+ mLastColor(ItemColor_one)
{
// Item name
mItemName->setFont(boldFont);
@@ -153,7 +153,7 @@ void ItemPopup::setItem(const Item *const item,
}
void ItemPopup::setItem(const ItemInfo &item,
- const unsigned char color,
+ const ItemColor color,
const bool showImage,
int id,
const int *const cards)
@@ -336,6 +336,6 @@ void ItemPopup::mouseMoved(MouseEvent &event)
void ItemPopup::resetPopup()
{
mLastName.clear();
- mLastColor = 1;
+ mLastColor = ItemColor_one;
mLastId = 0;
}
diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h
index fb3feefa2..a66262473 100644
--- a/src/gui/popups/itempopup.h
+++ b/src/gui/popups/itempopup.h
@@ -24,6 +24,8 @@
#ifndef GUI_POPUPS_ITEMPOPUP_H
#define GUI_POPUPS_ITEMPOPUP_H
+#include "enums/simpletypes/itemcolor.h"
+
#include "gui/widgets/popup.h"
#include "resources/itemtype.h"
@@ -58,7 +60,7 @@ class ItemPopup final : public Popup
* Sets the info to be displayed given a particular item.
*/
void setItem(const ItemInfo &item,
- const unsigned char color,
+ const ItemColor color,
const bool showImage,
int id,
const int *const cards);
@@ -82,7 +84,7 @@ class ItemPopup final : public Popup
Icon *mIcon;
std::string mLastName;
int mLastId;
- unsigned char mLastColor;
+ ItemColor mLastColor;
void setLabelColor(Label *label,
const ItemType::Type type) const A_NONNULL(2);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 9adcc7b58..71a6d81d5 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -105,7 +105,7 @@ PopupMenu::PopupMenu() :
mFloorItemId(BeingId_zero),
mItem(nullptr),
mItemId(0),
- mItemColor(1),
+ mItemColor(ItemColor_one),
mMapItem(nullptr),
mTab(nullptr),
mSpell(nullptr),
@@ -1558,7 +1558,7 @@ void PopupMenu::handleLink(const std::string &link,
replaceAll(cmd, "'BEINGID'", toString(toInt(mBeingId, int)));
replaceAll(cmd, "'FLOORID'", toString(toInt(mFloorItemId, int)));
replaceAll(cmd, "'ITEMID'", toString(mItemId));
- replaceAll(cmd, "'ITEMCOLOR'", toString(mItemColor));
+ replaceAll(cmd, "'ITEMCOLOR'", toString(toInt(mItemColor, int)));
replaceAll(cmd, "'BEINGTYPEID'", toString(static_cast<int>(mType)));
replaceAll(cmd, "'PLAYER'", localPlayer->getName());
if (mItem)
@@ -1594,7 +1594,7 @@ void PopupMenu::handleLink(const std::string &link,
mFloorItemId = BeingId_zero;
mItem = nullptr;
mItemId = 0;
- mItemColor = 1;
+ mItemColor = ItemColor_one;
mMapItem = nullptr;
mTab = nullptr;
mSpell = nullptr;
@@ -1751,8 +1751,9 @@ void PopupMenu::showPopup(Window *const parent,
showPopup(x, y);
}
-void PopupMenu::showItemPopup(const int x, const int y, const int itemId,
- const unsigned char color)
+void PopupMenu::showItemPopup(const int x, const int y,
+ const int itemId,
+ const ItemColor color)
{
const Inventory *const inv = PlayerInfo::getInventory();
if (!inv)
@@ -1788,7 +1789,8 @@ void PopupMenu::showItemPopup(const int x, const int y, const int itemId,
}
}
-void PopupMenu::showItemPopup(const int x, const int y, Item *const item)
+void PopupMenu::showItemPopup(const int x, const int y,
+ Item *const item)
{
mItem = item;
mX = x;
@@ -1801,7 +1803,7 @@ void PopupMenu::showItemPopup(const int x, const int y, Item *const item)
else
{
mItemId = 0;
- mItemColor = 1;
+ mItemColor = ItemColor_one;
}
mNick.clear();
mBrowserBox->clearRows();
@@ -2103,7 +2105,8 @@ void PopupMenu::showPickupItemPopup(const int x, const int y,
}
void PopupMenu::showUndressPopup(const int x, const int y,
- const Being *const being, Item *const item)
+ const Being *const being,
+ Item *const item)
{
if (!being || !item)
return;
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index 727818317..3952178f2 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -28,6 +28,7 @@
#include "enums/inventorytype.h"
#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/itemcolor.h"
#include "gui/widgets/linkhandler.h"
#include "gui/widgets/popup.h"
@@ -105,8 +106,9 @@ class PopupMenu final : public Popup, public LinkHandler
void showItemPopup(const int x, const int y, Item *const item);
- void showItemPopup(const int x, const int y, const int itemId,
- const unsigned char color);
+ void showItemPopup(const int x, const int y,
+ const int itemId,
+ const ItemColor color);
void showDropPopup(const int x, const int y, Item *const item);
@@ -208,7 +210,7 @@ class PopupMenu final : public Popup, public LinkHandler
BeingId mFloorItemId;
Item *mItem;
int mItemId;
- unsigned char mItemColor;
+ ItemColor mItemColor;
MapItem *mMapItem;
ChatTab *mTab;
TextCommand *mSpell;
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 5a11103d9..388f563bd 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -111,9 +111,9 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
splitToIntVector(str, link, ',');
if (str.empty())
return;
- unsigned char color = 1;
+ ItemColor color = ItemColor_one;
if (str.size() > 1)
- color = static_cast<unsigned char>(str[1]);
+ color = fromInt(str[1], ItemColor);
const int id = str[0];
if (id > 0)
{
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 689d967c8..21fe944ac 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -124,7 +124,7 @@ void ItemShortcutContainer::draw(Graphics *graphics)
itemX + 2, itemY + 2);
const int itemId = selShortcut->getItem(i);
- const unsigned char itemColor = selShortcut->getItemColor(i);
+ const ItemColor itemColor = selShortcut->getItemColor(i);
if (itemId < 0)
continue;
@@ -261,7 +261,7 @@ void ItemShortcutContainer::safeDraw(Graphics *graphics)
itemX + 2, itemY + 2);
const int itemId = selShortcut->getItem(i);
- const unsigned char itemColor = selShortcut->getItemColor(i);
+ const ItemColor itemColor = selShortcut->getItemColor(i);
if (itemId < 0)
continue;
@@ -372,7 +372,7 @@ void ItemShortcutContainer::mouseDragged(MouseEvent &event)
return;
const int itemId = selShortcut->getItem(index);
- const unsigned char itemColor = selShortcut->getItemColor(index);
+ const ItemColor itemColor = selShortcut->getItemColor(index);
if (itemId < 0)
return;
@@ -540,7 +540,7 @@ void ItemShortcutContainer::mouseMoved(MouseEvent &event)
return;
const int itemId = selShortcut->getItem(index);
- const unsigned char itemColor = selShortcut->getItemColor(index);
+ const ItemColor itemColor = selShortcut->getItemColor(index);
if (itemId < 0)
return;
diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp
index 6498c25b6..827d1c3ea 100644
--- a/src/gui/widgets/selldialog.cpp
+++ b/src/gui/widgets/selldialog.cpp
@@ -197,7 +197,7 @@ void SellDialog::addItem(const Item *const item, const int price)
void SellDialog::addItem(const int id,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount,
const int price)
{
diff --git a/src/gui/widgets/selldialog.h b/src/gui/widgets/selldialog.h
index dcc92cfd2..b5e91f67d 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/simpletypes/itemcolor.h"
+
#include "gui/widgets/window.h"
#include "listeners/actionlistener.h"
@@ -92,7 +94,7 @@ class SellDialog notfinal : public Window,
void addItem(const int id,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount,
const int price);
diff --git a/src/gui/widgets/virtshortcutcontainer.cpp b/src/gui/widgets/virtshortcutcontainer.cpp
index 3c28f244f..4066a915c 100644
--- a/src/gui/widgets/virtshortcutcontainer.cpp
+++ b/src/gui/widgets/virtshortcutcontainer.cpp
@@ -233,7 +233,7 @@ void VirtShortcutContainer::mouseDragged(MouseEvent &event)
return;
const int itemId = mShortcut->getItem(index);
- const unsigned char itemColor = mShortcut->getItemColor(index);
+ const ItemColor itemColor = mShortcut->getItemColor(index);
if (itemId < 0)
return;
@@ -347,7 +347,7 @@ void VirtShortcutContainer::mouseMoved(MouseEvent &event)
return;
const int itemId = mShortcut->getItem(index);
- const unsigned char itemColor = mShortcut->getItemColor(index);
+ const ItemColor itemColor = mShortcut->getItemColor(index);
if (itemId < 0)
return;
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 84a7a1182..667867ff4 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -363,7 +363,7 @@ void BuyDialog::reset()
ShopItem *BuyDialog::addItem(const int id,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount,
const int price)
{
@@ -493,7 +493,8 @@ void BuyDialog::action(const ActionEvent &event)
if (mNpcId == fromInt(Items, BeingId))
{
adminHandler->createItems(item->getId(),
- mAmountItems, item->getColor());
+ item->getColor(),
+ mAmountItems);
}
else if (mNpcId != fromInt(Nick, BeingId))
{
diff --git a/src/gui/windows/buydialog.h b/src/gui/windows/buydialog.h
index 7aaa1e7c5..104b5c4ee 100644
--- a/src/gui/windows/buydialog.h
+++ b/src/gui/windows/buydialog.h
@@ -24,6 +24,7 @@
#define GUI_WINDOWS_BUYDIALOG_H
#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/itemcolor.h"
#include "gui/widgets/window.h"
@@ -105,7 +106,7 @@ class BuyDialog final : public Window,
*/
ShopItem *addItem(const int id,
const int type,
- const unsigned char color,
+ const ItemColor color,
const int amount,
const int price);
diff --git a/src/gui/windows/buyingstoreselldialog.cpp b/src/gui/windows/buyingstoreselldialog.cpp
index 55b6a96fb..637bdc5bd 100644
--- a/src/gui/windows/buyingstoreselldialog.cpp
+++ b/src/gui/windows/buyingstoreselldialog.cpp
@@ -58,7 +58,7 @@ void BuyingStoreSellDialog::sellAction(const ActionEvent &event A_UNUSED)
return;
// +++ need add colors
Item *const item2 = PlayerInfo::getInventory()->findItem(
- item1->getId(), 1);
+ item1->getId(), ItemColor_one);
if (!item2)
return;
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 2168ad0a1..6af4a6437 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -624,11 +624,13 @@ void CharCreateDialog::updateHair()
{
mHairColor = minHairColor;
}
- mHairColorNameLabel->setCaption(ColorDB::getHairColorName(mHairColor));
+ mHairColorNameLabel->setCaption(ColorDB::getHairColorName(
+ fromInt(mHairColor, ItemColor)));
mHairColorNameLabel->resizeTo(150, 150);
mPlayer->setSprite(charServerHandler->hairSprite(),
- mHairStyle * -1, item.getDyeColorsString(mHairColor));
+ mHairStyle * -1,
+ item.getDyeColorsString(fromInt(mHairColor, ItemColor)));
}
void CharCreateDialog::updateRace()
@@ -667,7 +669,8 @@ void CharCreateDialog::updateLook()
}
if (mLookNameLabel)
{
- mLookNameLabel->setCaption(item.getColorName(mLook));
+ mLookNameLabel->setCaption(item.getColorName(
+ fromInt(mLook, ItemColor)));
mLookNameLabel->resizeTo(150, 150);
}
}
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index b1c10f058..a48a6dab2 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -355,7 +355,8 @@ void ItemAmountWindow::action(const ActionEvent &event)
const int id = ItemDB::get(mItemsModal->getElementAt(
mItemDropDown->getSelected())).getId();
- mItem = new Item(id, 0, 10000, 0, 1,
+ mItem = new Item(id, 0, 10000, 0,
+ ItemColor_one,
Identified_true,
Damaged_true,
Favorite_false,
diff --git a/src/gui/windows/maileditwindow.cpp b/src/gui/windows/maileditwindow.cpp
index 1699b979c..51495563d 100644
--- a/src/gui/windows/maileditwindow.cpp
+++ b/src/gui/windows/maileditwindow.cpp
@@ -138,7 +138,8 @@ void MailEditWindow::action(const ActionEvent &event)
const Inventory *const inv = PlayerInfo::getInventory();
if (inv)
{
- const Item *const item = inv->findItem(tempItem->getId(), 1);
+ const Item *const item = inv->findItem(
+ tempItem->getId(), ItemColor_one);
if (item)
{
mailHandler->setAttach(item->getInvIndex(),
diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp
index 544c80f0d..ad7eb8a88 100644
--- a/src/gui/windows/mailviewwindow.cpp
+++ b/src/gui/windows/mailviewwindow.cpp
@@ -111,7 +111,8 @@ MailViewWindow::MailViewWindow(const MailMessage *const message) :
const ItemInfo &item = ItemDB::get(message->itemId);
Image *const image = resman->getImage(combineDye2(
paths.getStringValue("itemIcons").append(
- item.getDisplay().image), item.getDyeColorsString(1)));
+ item.getDisplay().image),
+ item.getDyeColorsString(ItemColor_one)));
mIcon = new Icon(this, image);
if (message->itemAmount != 1)
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 10eb3dc8a..c0396bc06 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -369,7 +369,7 @@ void NpcDialog::action(const ActionEvent &event)
if (item)
{
str = strprintf("%d,%d", item->getId(),
- item->getColor());
+ toInt(item->getColor(), int));
}
else
{
@@ -382,7 +382,7 @@ void NpcDialog::action(const ActionEvent &event)
if (item)
{
str.append(strprintf("%d,%d", item->getId(),
- item->getColor()));
+ toInt(item->getColor(), int)));
}
else
{
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index a0a7fa7c2..7ce43333b 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -172,7 +172,7 @@ void OutfitWindow::load(const bool oldConfig)
for (size_t i = 0, sz = tokens2.size();
i < sz && i < OUTFIT_ITEM_COUNT; i++)
{
- mItemColors[o][i] = tokens2[i];
+ mItemColors[o][i] = fromInt(tokens2[i], ItemColor);
}
mItemsUnequip[o] = cfg->getValueBool("OutfitUnequip" + toString(o),
@@ -203,7 +203,7 @@ void OutfitWindow::save() const
if (i < OUTFIT_ITEM_COUNT - 1)
outfitStr.append(" ");
outfitColorsStr.append(toString(static_cast<int>(
- mItemColors[o][i])));
+ toInt(mItemColors[o][i], int))));
if (i < OUTFIT_ITEM_COUNT - 1)
outfitColorsStr.append(" ");
}
@@ -278,7 +278,8 @@ void OutfitWindow::wearOutfit(const int outfit, const bool unwearEmpty,
for (unsigned i = 0; i < OUTFIT_ITEM_COUNT; i++)
{
const Item *const item = PlayerInfo::getInventory()->findItem(
- mItems[outfit][i], mItemColors[outfit][i]);
+ mItems[outfit][i],
+ mItemColors[outfit][i]);
if (item
&& item->isEquipped() == Equipped_false
&& item->getQuantity())
@@ -453,7 +454,7 @@ void OutfitWindow::mouseDragged(MouseEvent &event)
return;
}
const int itemId = mItems[mCurrentOutfit][index];
- const unsigned char itemColor = mItemColors[mCurrentOutfit][index];
+ const ItemColor itemColor = mItemColors[mCurrentOutfit][index];
if (itemId < 0)
{
Window::mouseDragged(event);
@@ -719,7 +720,7 @@ void OutfitWindow::clearCurrentOutfit()
for (unsigned f = 0; f < OUTFIT_ITEM_COUNT; f++)
{
mItems[mCurrentOutfit][f] = -1;
- mItemColors[mCurrentOutfit][f] = 1;
+ mItemColors[mCurrentOutfit][f] = ItemColor_one;
}
save();
}
diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h
index 7033a3f13..27a3d73aa 100644
--- a/src/gui/windows/outfitwindow.h
+++ b/src/gui/windows/outfitwindow.h
@@ -23,6 +23,8 @@
#ifndef GUI_WINDOWS_OUTFITWINDOW_H
#define GUI_WINDOWS_OUTFITWINDOW_H
+#include "enums/simpletypes/itemcolor.h"
+
#include "gui/widgets/window.h"
#include "listeners/actionlistener.h"
@@ -119,7 +121,7 @@ class OutfitWindow final : public Window,
int mItems[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT];
int mAwayOutfit;
- unsigned char mItemColors[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT];
+ ItemColor mItemColors[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT];
bool mItemClicked;
bool mItemsUnequip[OUTFITS_COUNT];
};
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index b8e31ead8..c5014f902 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -348,7 +348,8 @@ void ShopWindow::action(const ActionEvent &event)
if (!item)
continue;
// +++ need add colors
- Item *const cartItem = inv->findItem(item->getId(), 1);
+ Item *const cartItem = inv->findItem(item->getId(),
+ ItemColor_one);
if (!cartItem)
continue;
item->setInvIndex(cartItem->getInvIndex());
@@ -391,7 +392,7 @@ void ShopWindow::action(const ActionEvent &event)
return;
// +++ need support for colors
- Item *const item = inv->findItem(mSelectedItem, 0);
+ Item *const item = inv->findItem(mSelectedItem, ItemColor_zero);
if (item)
{
if (eventId == "add")
@@ -551,12 +552,12 @@ void ShopWindow::loadList()
if (tokens[1] && tokens[2] && mBuyShopItems)
{
mBuyShopItems->addItem(
- tokens[0], 0, 1, tokens[1], tokens[2]);
+ tokens[0], 0, ItemColor_one, tokens[1], tokens[2]);
}
if (tokens[3] && tokens[4] && mSellShopItems)
{
mSellShopItems->addItem(
- tokens[0], 0, 1, tokens[3], tokens[4]);
+ tokens[0], 0, ItemColor_one, tokens[3], tokens[4]);
}
}
}
@@ -748,7 +749,8 @@ void ShopWindow::giveList(const std::string &nick, const int mode)
if (mode == SELL)
{
// +++ need support for colors
- const Item *const item2 = inv->findItem(item->getId(), 0);
+ const Item *const item2 = inv->findItem(item->getId(),
+ ItemColor_zero);
if (item2)
{
int amount = item->getQuantity();
@@ -844,19 +846,19 @@ 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, 1, amount, price);
+ buyDialog->addItem(id, 0, ItemColor_one, amount, price);
if (sellDialog)
{
// +++ need support for colors
- const Item *const item = inv->findItem(id, 0);
+ const Item *const item = inv->findItem(id, ItemColor_zero);
if (item)
{
if (item->getQuantity() < amount)
amount = item->getQuantity();
if (amount > 0)
- sellDialog->addItem(id, 0, 1, amount, price);
+ sellDialog->addItem(id, 0, ItemColor_one, amount, price);
else
- sellDialog->addItem(id, 0, 1, -1, price);
+ sellDialog->addItem(id, 0, ItemColor_one, -1, price);
}
}
}
@@ -919,12 +921,13 @@ void ShopWindow::processRequest(const std::string &nick, std::string data,
delete mTradeItem;
// +++ need impliment colors?
- mTradeItem = new ShopItem(-1, id, 0, 1, amount, price);
+ mTradeItem = new ShopItem(-1, id, 0, ItemColor_one, amount, price);
if (mode == BUY)
{
// +++ need support for colors
- const Item *const item2 = inv->findItem(mTradeItem->getId(), 0);
+ const Item *const item2 = inv->findItem(mTradeItem->getId(),
+ ItemColor_zero);
if (!item2 || item2->getQuantity() < amount
|| !findShopItem(mTradeItem, SELL))
{
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index bf4963daf..7a835b686 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -196,7 +196,7 @@ void TradeWindow::addItem(const int id,
const bool own,
const int quantity,
const uint8_t refine,
- const unsigned char color,
+ const ItemColor color,
const Identified identified,
const Damaged damaged,
const Favorite favorite) const
@@ -221,7 +221,7 @@ void TradeWindow::addItem2(const int id,
const bool own,
const int quantity,
const uint8_t refine,
- const unsigned char color,
+ const ItemColor color,
const Identified identified,
const Damaged damaged,
const Favorite favorite,
diff --git a/src/gui/windows/tradewindow.h b/src/gui/windows/tradewindow.h
index a191671d5..b1ac84045 100644
--- a/src/gui/windows/tradewindow.h
+++ b/src/gui/windows/tradewindow.h
@@ -29,6 +29,7 @@
#include "enums/simpletypes/equipm.h"
#include "enums/simpletypes/favorite.h"
#include "enums/simpletypes/identified.h"
+#include "enums/simpletypes/itemcolor.h"
#include "listeners/actionlistener.h"
#include "listeners/selectionlistener.h"
@@ -75,7 +76,7 @@ class TradeWindow final : public Window,
const bool own,
const int quantity,
const uint8_t refine,
- const unsigned char color,
+ const ItemColor color,
const Identified identified,
const Damaged damaged,
const Favorite favorite) const;
@@ -95,7 +96,7 @@ class TradeWindow final : public Window,
const bool own,
const int quantity,
const uint8_t refine,
- const unsigned char color,
+ const ItemColor color,
const Identified identified,
const Damaged damaged,
const Favorite favorite,