diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-11-11 21:29:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-11-11 21:30:42 +0300 |
commit | c6997f8ee41d5f85dd8a1269e82982e1ab0b5c74 (patch) | |
tree | d34c46ef9d3cf927c6b3a0756cfa6d87283773a8 /src/gui/windows/shopwindow.cpp | |
parent | 540ddb5411378d5e60c942cda230ddf186bdfbc6 (diff) | |
download | mv-c6997f8ee41d5f85dd8a1269e82982e1ab0b5c74.tar.gz mv-c6997f8ee41d5f85dd8a1269e82982e1ab0b5c74.tar.bz2 mv-c6997f8ee41d5f85dd8a1269e82982e1ab0b5c74.tar.xz mv-c6997f8ee41d5f85dd8a1269e82982e1ab0b5c74.zip |
In personal shops in sell dialog shop no existing items with amount 0 and disabled.
Only for legacy servers.
Diffstat (limited to 'src/gui/windows/shopwindow.cpp')
-rw-r--r-- | src/gui/windows/shopwindow.cpp | 18 |
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) |