From 3a9f3469e65e1c45a8cdf9c6ae21e73c90b87d22 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 3 Jul 2014 17:28:10 +0300 Subject: In inventory disable use button if selected item unusable. --- src/gui/windows/inventorywindow.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/gui/windows') diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index ee9641927..5a29d5de0 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -630,21 +630,29 @@ void InventoryWindow::updateButtons(const Item *item) if (!item || item->getQuantity() == 0) { if (mUseButton) - mUseButton->setEnabled(true); + mUseButton->setEnabled(false); if (mDropButton) - mDropButton->setEnabled(true); + mDropButton->setEnabled(false); return; } - if (mUseButton) - mUseButton->setEnabled(true); if (mDropButton) mDropButton->setEnabled(true); if (mUseButton) { const ItemInfo &info = item->getInfo(); - mUseButton->setCaption(info.getUseButton()); + const std::string &str = info.getUseButton(); + if (str.empty()) + { + mUseButton->setEnabled(false); + mUseButton->setCaption(_("Use")); + } + else + { + mUseButton->setEnabled(true); + mUseButton->setCaption(str); + } } updateDropButton(); -- cgit v1.2.3-70-g09d2