summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-02 02:06:43 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-02 22:48:09 +0300
commit610b19c083565f1f6c153fadff80fc0e7475168f (patch)
tree118b2e160534c99c164ffd1dc6591bcb87a3619b
parent45ba0e489cf85d957c26f1e5895399953c203cd9 (diff)
downloadmanaplus-610b19c083565f1f6c153fadff80fc0e7475168f.tar.gz
manaplus-610b19c083565f1f6c153fadff80fc0e7475168f.tar.bz2
manaplus-610b19c083565f1f6c153fadff80fc0e7475168f.tar.xz
manaplus-610b19c083565f1f6c153fadff80fc0e7475168f.zip
Fix wening shop if item amount in shop more than present in cart.
-rw-r--r--src/gui/windows/shopwindow.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 2541ae247..a845d3404 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -287,6 +287,8 @@ void ShopWindow::action(const ActionEvent &event)
FOR_EACH (std::vector<ShopItem*>::iterator, it, oldItems)
{
ShopItem *const item = *it;
+ if (!item)
+ continue;
// +++ need add colors
Item *const cartItem = inv->findItem(item->getId(), 1);
if (!cartItem)
@@ -295,7 +297,7 @@ void ShopWindow::action(const ActionEvent &event)
const int amount = cartItem->getQuantity();
if (!amount)
continue;
- if (item->getQuantity() < amount)
+ if (item->getQuantity() > amount)
item->setQuantity(amount);
items.push_back(item);
if (static_cast<signed int>(items.size()) >= mSellShopSize)