From 37f8e4429b9620e6734fa5f1c9a760181dc35001 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 12 Apr 2011 02:46:54 +0300 Subject: Updating equip/unequip buttons in inventory. --- src/gui/inventorywindow.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/gui/inventorywindow.cpp') diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 403868cd1..a41334d06 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -427,6 +427,20 @@ void InventoryWindow::valueChanged(const gcn::SelectionEvent &event _UNUSED_) ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, this, item, (item->getQuantity() - 1)); } + updateButtons(item); +} + +void InventoryWindow::updateButtons(Item *item) +{ + if (!mInventory || !mInventory->isMainInventory()) + return; + + Item *selectedItem = mItems->getSelectedItem(); + if (item && selectedItem != item) + return; + + if (!item) + item = selectedItem; if (!item || item->getQuantity() == 0) { @@ -472,8 +486,8 @@ void InventoryWindow::valueChanged(const gcn::SelectionEvent &event _UNUSED_) else mSplitButton->setEnabled(false); } -} +} void InventoryWindow::setSplitAllowed(bool allowed) { -- cgit v1.2.3-70-g09d2