summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-02 21:48:15 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-03 00:13:45 +0300
commit1a34e0c62d1d033d79b28c4a9bfd85a2ccd093ad (patch)
tree56cc59d159ece92b441769168bc6ce1bd8d7c2cb /src
parente54b8369a982585445c84c8590bdb1c16701763f (diff)
downloadmanaplus-1a34e0c62d1d033d79b28c4a9bfd85a2ccd093ad.tar.gz
manaplus-1a34e0c62d1d033d79b28c4a9bfd85a2ccd093ad.tar.bz2
manaplus-1a34e0c62d1d033d79b28c4a9bfd85a2ccd093ad.tar.xz
manaplus-1a34e0c62d1d033d79b28c4a9bfd85a2ccd093ad.zip
Fix buttons in shop window based on state.
Diffstat (limited to 'src')
-rw-r--r--src/gui/windows/shopwindow.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index a845d3404..1068aca2b 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -365,18 +365,23 @@ void ShopWindow::valueChanged(const SelectionEvent &event A_UNUSED)
void ShopWindow::updateButtonsAndLabels()
{
- mAddButton->setEnabled(mSelectedItem != -1);
bool allowDel(false);
+ bool allowAdd(false);
const bool sellNotEmpty = mSellShopItems->getNumberOfElements() > 0;
if (isBuySelected)
{
+ allowAdd = !mEnableVending;
allowDel = mBuyShopItemList->getSelected() != -1
&& mBuyShopItems->getNumberOfElements() > 0;
}
else
{
- allowDel = mSellShopItemList->getSelected() != -1 && sellNotEmpty;
+ allowAdd = !mEnableVending && mSelectedItem != -1;
+ allowDel = !mEnableVending
+ && mSellShopItemList->getSelected() != -1
+ && sellNotEmpty;
}
+ mAddButton->setEnabled(allowAdd);
mDeleteButton->setEnabled(allowDel);
if (mPublishButton)
{
@@ -973,11 +978,14 @@ void ShopWindow::updateSelection()
void ShopWindow::vendingSlotsChanged(const int slots)
{
mSellShopSize = slots;
+ updateButtonsAndLabels();
}
void ShopWindow::vendingEnabled(const bool b)
{
mEnableVending = b;
- updateButtonsAndLabels();
localPlayer->enableShop(b);
+ if (!b)
+ mSellShopSize = 0;
+ updateButtonsAndLabels();
}