summaryrefslogtreecommitdiff
path: root/src/shopitem.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-04 19:06:32 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-04 19:06:32 +0200
commitfcf12d937c55e115e80325f8fbd6069f27a667a3 (patch)
tree26203cd700697f30f9fb8b149b3658deae7db559 /src/shopitem.cpp
parentd6ef8f92a7abe1e4a635e86f1bcf2675ffbc6658 (diff)
downloadManaVerse-fcf12d937c55e115e80325f8fbd6069f27a667a3.tar.gz
ManaVerse-fcf12d937c55e115e80325f8fbd6069f27a667a3.tar.bz2
ManaVerse-fcf12d937c55e115e80325f8fbd6069f27a667a3.tar.xz
ManaVerse-fcf12d937c55e115e80325f8fbd6069f27a667a3.zip
Update item amount in sell dialog.
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;