summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-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();
}