diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-02-04 19:06:32 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-02-04 19:06:32 +0200 |
commit | fcf12d937c55e115e80325f8fbd6069f27a667a3 (patch) | |
tree | 26203cd700697f30f9fb8b149b3658deae7db559 /src/shopitem.cpp | |
parent | d6ef8f92a7abe1e4a635e86f1bcf2675ffbc6658 (diff) | |
download | manaplus-fcf12d937c55e115e80325f8fbd6069f27a667a3.tar.gz manaplus-fcf12d937c55e115e80325f8fbd6069f27a667a3.tar.bz2 manaplus-fcf12d937c55e115e80325f8fbd6069f27a667a3.tar.xz manaplus-fcf12d937c55e115e80325f8fbd6069f27a667a3.zip |
Update item amount in sell dialog.
Diffstat (limited to 'src/shopitem.cpp')
-rw-r--r-- | src/shopitem.cpp | 19 |
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; |