From d557ce63e240960746e48c678b4a08ba66f7fe40 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 6 Feb 2017 16:58:18 +0300 Subject: Add custom currency also into shop items list. --- src/resources/item/shopitem.cpp | 10 +++++++--- src/resources/item/shopitem.h | 7 +++++-- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/resources') diff --git a/src/resources/item/shopitem.cpp b/src/resources/item/shopitem.cpp index b3d088b36..27a496814 100644 --- a/src/resources/item/shopitem.cpp +++ b/src/resources/item/shopitem.cpp @@ -37,7 +37,8 @@ ShopItem::ShopItem(const int inventoryIndex, const ItemTypeT type, const ItemColor color, const int quantity, - const int price) : + const int price, + const std::string ¤cy) : Item(id, type, 0, 0, color, Identified_true, Damaged_false, @@ -45,6 +46,7 @@ ShopItem::ShopItem(const int inventoryIndex, Equipm_false, Equipped_false), mDisplayName(), + mCurrency(currency), mDuplicates(), mPrice(price), mUsedQuantity(0), @@ -60,7 +62,8 @@ ShopItem::ShopItem(const int inventoryIndex, ShopItem::ShopItem(const int id, const ItemTypeT type, const ItemColor color, - const int price) : + const int price, + const std::string ¤cy) : Item(id, type, 0, 0, color, Identified_true, Damaged_false, @@ -68,6 +71,7 @@ ShopItem::ShopItem(const int id, Equipm_false, Equipped_false), mDisplayName(), + mCurrency(currency), mDuplicates(), mPrice(price), mUsedQuantity(0), @@ -99,7 +103,7 @@ void ShopItem::updateDisplayName(const int quantity) if (mPrice) { mDisplayName.append(" (").append( - UnitsDb::formatCurrency(mPrice)).append(") "); + UnitsDb::formatCurrency(mCurrency, mPrice)).append(") "); } if (mShowQuantity && quantity > 1) mDisplayName.append("[").append(toString(quantity)).append("]"); diff --git a/src/resources/item/shopitem.h b/src/resources/item/shopitem.h index 96b8fcbf9..7596d0269 100644 --- a/src/resources/item/shopitem.h +++ b/src/resources/item/shopitem.h @@ -49,7 +49,8 @@ class ShopItem final : public Item const ItemTypeT type, const ItemColor color, const int quantity, - const int price); + const int price, + const std::string ¤cy); /** * Constructor. Creates a new ShopItem. Inventory index will be set to @@ -61,7 +62,8 @@ class ShopItem final : public Item ShopItem(const int id, const ItemTypeT type, const ItemColor color, - const int price); + const int price, + const std::string ¤cy); A_DELETE_COPY(ShopItem) @@ -158,6 +160,7 @@ class ShopItem final : public Item void updateDisplayName(const int quantity); std::string mDisplayName; + std::string mCurrency; /** * Struct to keep track of duplicates. -- cgit v1.2.3-60-g2f50