summaryrefslogtreecommitdiff
path: root/src/gui/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/models')
-rw-r--r--src/gui/models/shopitems.cpp28
-rw-r--r--src/gui/models/shopitems.h5
2 files changed, 28 insertions, 5 deletions
diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp
index 061da5110..94bba3be4 100644
--- a/src/gui/models/shopitems.cpp
+++ b/src/gui/models/shopitems.cpp
@@ -28,10 +28,12 @@
#include "debug.h"
-ShopItems::ShopItems(const bool mergeDuplicates) :
+ShopItems::ShopItems(const bool mergeDuplicates,
+ const std::string &currency) :
ListModel(),
mAllShopItems(),
mShopItems(),
+ mCurrency(currency),
mMergeDuplicates(mergeDuplicates)
{
}
@@ -58,7 +60,13 @@ ShopItem *ShopItems::addItem(const int id,
const int amount,
const int price)
{
- ShopItem *const item = new ShopItem(-1, id, type, color, amount, price);
+ ShopItem *const item = new ShopItem(-1,
+ id,
+ type,
+ color,
+ amount,
+ price,
+ mCurrency);
mShopItems.push_back(item);
mAllShopItems.push_back(item);
return item;
@@ -73,7 +81,13 @@ ShopItem *ShopItems::addItemNoDup(const int id,
ShopItem *item = findItem(id, color);
if (!item)
{
- item = new ShopItem(-1, id, type, color, amount, price);
+ item = new ShopItem(-1,
+ id,
+ type,
+ color,
+ amount,
+ price,
+ mCurrency);
mShopItems.push_back(item);
mAllShopItems.push_back(item);
}
@@ -97,7 +111,13 @@ ShopItem *ShopItems::addItem2(const int inventoryIndex,
}
else
{
- item = new ShopItem(inventoryIndex, id, type, color, quantity, price);
+ item = new ShopItem(inventoryIndex,
+ id,
+ type,
+ color,
+ quantity,
+ price,
+ mCurrency);
mShopItems.push_back(item);
mAllShopItems.push_back(item);
}
diff --git a/src/gui/models/shopitems.h b/src/gui/models/shopitems.h
index 42594a7c6..3b6d611cb 100644
--- a/src/gui/models/shopitems.h
+++ b/src/gui/models/shopitems.h
@@ -53,7 +53,8 @@ class ShopItems final : public ListModel
* @param mergeDuplicates lets the Shop look for duplicate entries and
* merges them to one item.
*/
- explicit ShopItems(const bool mergeDuplicates = false);
+ ShopItems(const bool mergeDuplicates,
+ const std::string &currency);
A_DELETE_COPY(ShopItems)
@@ -159,6 +160,8 @@ class ShopItems final : public ListModel
std::vector<ShopItem*> mShopItems;
+ std::string mCurrency;
+
/** Look for duplicate entries on addition. */
bool mMergeDuplicates;
};