From c6997f8ee41d5f85dd8a1269e82982e1ab0b5c74 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 11 Nov 2015 21:29:51 +0300 Subject: In personal shops in sell dialog shop no existing items with amount 0 and disabled. Only for legacy servers. --- src/gui/windows/shopwindow.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/gui/windows/shopwindow.cpp') 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) -- cgit v1.2.3-60-g2f50