diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-04-12 02:46:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-04-12 02:46:54 +0300 |
commit | 37f8e4429b9620e6734fa5f1c9a760181dc35001 (patch) | |
tree | c5562f94fd8f890a3427b6f3e14b138819999e8a /src/gui/inventorywindow.cpp | |
parent | 474a96f27843a544b0a340c7a3b24d262490d5c8 (diff) | |
download | mv-37f8e4429b9620e6734fa5f1c9a760181dc35001.tar.gz mv-37f8e4429b9620e6734fa5f1c9a760181dc35001.tar.bz2 mv-37f8e4429b9620e6734fa5f1c9a760181dc35001.tar.xz mv-37f8e4429b9620e6734fa5f1c9a760181dc35001.zip |
Updating equip/unequip buttons in inventory.
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r-- | src/gui/inventorywindow.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
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) { |