summaryrefslogtreecommitdiff
path: root/src/gui/windows/shopwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/shopwindow.cpp')
-rw-r--r--src/gui/windows/shopwindow.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 645ae5314..67e361715 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -849,15 +849,25 @@ void ShopWindow::showList(const std::string &nick, std::string data)
{
// +++ need support for colors
const Item *const item = inv->findItem(id, ItemColor_zero);
+ bool enabled(true);
+
if (item)
{
if (item->getQuantity() < amount)
amount = item->getQuantity();
- if (amount > 0)
- sellDialog->addItem(id, 0, ItemColor_one, amount, price);
- else
- sellDialog->addItem(id, 0, ItemColor_one, -1, price);
}
+ else
+ {
+ amount = 0;
+ }
+ ShopItem *const shopItem = sellDialog->addItem(id,
+ 0,
+ ItemColor_one,
+ amount,
+ price);
+
+ if (shopItem && amount <= 0)
+ shopItem->setDisabled(true);
}
}
if (buyDialog)