summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being/being.cpp10
-rw-r--r--src/being/being.h5
-rw-r--r--src/gui/popups/popupmenu.cpp17
3 files changed, 25 insertions, 7 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 97fad3c59..4a3e4d0cb 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -3551,3 +3551,13 @@ void Being::enableShop(const bool b)
mShop = b;
updateName();
}
+
+bool Being::isBuyShopEnabled() const
+{
+ return mShop && (!serverFeatures->haveVending() || !mBuyBoard.empty());
+}
+
+bool Being::isSellShopEnabled() const
+{
+ return mShop && (!serverFeatures->haveVending() || !mSellBoard.empty());
+}
diff --git a/src/being/being.h b/src/being/being.h
index a6b588919..12b197a23 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -761,8 +761,9 @@ class Being notfinal : public ActorSprite,
void setAdvanced(const bool n)
{ mAdvanced = n; addToCache(); }
- bool isShopEnabled() const A_WARN_UNUSED
- { return mShop; }
+ bool isBuyShopEnabled() const A_WARN_UNUSED;
+
+ bool isSellShopEnabled() const A_WARN_UNUSED;
void enableShop(const bool b);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 188c8ae9a..d596f1a50 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2366,20 +2366,27 @@ void PopupMenu::addBuySell(const Being *const being)
if (player_relations.getDefault() & PlayerRelation::TRADE)
{
mBrowserBox->addRow("##3---");
- if (being->isShopEnabled())
+ const bool haveVending = serverFeatures->haveVending();
+ if (being->isSellShopEnabled())
{
// TRANSLATORS: popup menu item
// TRANSLATORS: buy item
mBrowserBox->addRow("/buy 'NAME'", _("Buy"));
- // TRANSLATORS: popup menu item
- // TRANSLATORS: sell item
- mBrowserBox->addRow("/sell 'NAME'", _("Sell"));
}
- else
+ else if (!haveVending)
{
// TRANSLATORS: popup menu item
// TRANSLATORS: buy item
mBrowserBox->addRow("/buy 'NAME'", _("Buy (?)"));
+ }
+ if (being->isBuyShopEnabled())
+ {
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: sell item
+ mBrowserBox->addRow("/sell 'NAME'", _("Sell"));
+ }
+ else if (!haveVending)
+ {
// TRANSLATORS: popup menu item
// TRANSLATORS: sell item
mBrowserBox->addRow("/sell 'NAME'", _("Sell (?)"));