From fcf12d937c55e115e80325f8fbd6069f27a667a3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 4 Feb 2011 19:06:32 +0200 Subject: Update item amount in sell dialog. --- src/shopitem.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/shopitem.cpp') 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; -- cgit v1.2.3-60-g2f50