diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-02 02:06:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-02 22:48:09 +0300 |
commit | 610b19c083565f1f6c153fadff80fc0e7475168f (patch) | |
tree | 118b2e160534c99c164ffd1dc6591bcb87a3619b /src/gui | |
parent | 45ba0e489cf85d957c26f1e5895399953c203cd9 (diff) | |
download | plus-610b19c083565f1f6c153fadff80fc0e7475168f.tar.gz plus-610b19c083565f1f6c153fadff80fc0e7475168f.tar.bz2 plus-610b19c083565f1f6c153fadff80fc0e7475168f.tar.xz plus-610b19c083565f1f6c153fadff80fc0e7475168f.zip |
Fix wening shop if item amount in shop more than present in cart.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/windows/shopwindow.cpp | 4 |
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) |