summaryrefslogtreecommitdiff
path: root/src/gui/widgets
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/widgets
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/widgets')
-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
5 files changed, 12 insertions, 10 deletions
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;