summaryrefslogtreecommitdiff
path: root/src/gui/models
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/models
parent7aa637abc8b0bca35aacdb9492e65f557ed32038 (diff)
downloadmv-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.gz
mv-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.bz2
mv-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.xz
mv-41cc92f73e39cec5dfea6b1164176610cccc7df4.zip
Add strong typed int for item color.
Diffstat (limited to 'src/gui/models')
-rw-r--r--src/gui/models/shopitems.cpp9
-rw-r--r--src/gui/models/shopitems.h10
2 files changed, 11 insertions, 8 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);