summaryrefslogtreecommitdiff
path: root/src/shopitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shopitem.cpp')
-rw-r--r--src/shopitem.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/shopitem.cpp b/src/shopitem.cpp
index 56fec1fac..4ed0459de 100644
--- a/src/shopitem.cpp
+++ b/src/shopitem.cpp
@@ -30,7 +30,8 @@
ShopItem::ShopItem(int inventoryIndex, int id,
int quantity, int price) :
Item(id, 0),
- mPrice(price)
+ mPrice(price),
+ mShowQuantity(true)
{
mDisplayName = getInfo().getName() + " ("
+ Units::formatCurrency(mPrice).c_str() + ") ";
@@ -41,7 +42,10 @@ ShopItem::ShopItem(int inventoryIndex, int id,
addDuplicate(inventoryIndex, quantity);
}
-ShopItem::ShopItem (int id, int price) : Item (id, 0), mPrice(price)
+ShopItem::ShopItem (int id, int price) :
+ Item (id, 0),
+ mPrice(price),
+ mShowQuantity(false)
{
mDisplayName = getInfo().getName() +
" (" + Units::formatCurrency(mPrice).c_str() + ")";
@@ -59,6 +63,17 @@ ShopItem::~ShopItem()
}
}
+void ShopItem::update()
+{
+ if (mShowQuantity)
+ {
+ mDisplayName = getInfo().getName() + " ("
+ + Units::formatCurrency(mPrice).c_str() + ") ";
+ if (mQuantity > 0)
+ mDisplayName += "[" + toString(mQuantity) + "]";
+ }
+}
+
void ShopItem::addDuplicate(int inventoryIndex, int quantity)
{
DuplicateItem* di = new DuplicateItem;