summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-01 20:11:13 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-01 20:11:13 +0300
commitd9be3eb4cf0ebbe29ef93759a3d168ebe9e592c1 (patch)
treecf04cf0aeaaa854eacf8718d80c2ad863c24ebb5
parentf06f491e3f9a5c47b98ec136c8eee7789152ce32 (diff)
downloadmv-d9be3eb4cf0ebbe29ef93759a3d168ebe9e592c1.tar.gz
mv-d9be3eb4cf0ebbe29ef93759a3d168ebe9e592c1.tar.bz2
mv-d9be3eb4cf0ebbe29ef93759a3d168ebe9e592c1.tar.xz
mv-d9be3eb4cf0ebbe29ef93759a3d168ebe9e592c1.zip
Remove ServerFeatures haveVending because it depend only on server type.
-rw-r--r--src/actions/actions.cpp8
-rw-r--r--src/being/being.cpp17
-rw-r--r--src/being/localplayer.cpp2
-rw-r--r--src/gui/popups/popupmenu.cpp3
-rw-r--r--src/gui/windows/shopwindow.cpp3
-rw-r--r--src/net/eathena/serverfeatures.cpp5
-rw-r--r--src/net/eathena/serverfeatures.h2
-rw-r--r--src/net/serverfeatures.h2
-rw-r--r--src/net/tmwa/serverfeatures.cpp5
-rw-r--r--src/net/tmwa/serverfeatures.h2
10 files changed, 20 insertions, 29 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 844c91272..698d1f4f8 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -703,7 +703,7 @@ impHandler(buy)
return false;
const std::string args = event.args;
Being *being = findBeing(args, false);
- if (!being && !serverFeatures->haveVending())
+ if (!being && Net::getNetworkType() == ServerType::TMWATHENA)
{
if (whoIsOnline)
{
@@ -733,7 +733,7 @@ impHandler(buy)
}
else if (being->getType() == ActorType::Player)
{
- if (vendingHandler && serverFeatures->haveVending())
+ if (vendingHandler && Net::getNetworkType() == ServerType::EATHENA)
vendingHandler->open(being);
else if (buySellHandler)
buySellHandler->requestSellList(being->getName());
@@ -749,7 +749,7 @@ impHandler(sell)
const std::string args = event.args;
Being *being = findBeing(args, false);
- if (!being && !serverFeatures->haveVending())
+ if (!being && Net::getNetworkType() == ServerType::TMWATHENA)
{
if (whoIsOnline)
{
@@ -779,7 +779,7 @@ impHandler(sell)
}
else if (being->getType() == ActorType::Player)
{
- if (buyingStoreHandler && serverFeatures->haveVending())
+ if (buyingStoreHandler && Net::getNetworkType() == ServerType::EATHENA)
buyingStoreHandler->open(being);
else if (buySellHandler)
buySellHandler->requestBuyList(being->getName());
diff --git a/src/being/being.cpp b/src/being/being.cpp
index dfb337598..7cfc18760 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -3321,8 +3321,11 @@ bool Being::updateFromCache() restrict2
if (mAdvanced)
{
const int flags = entry->getFlags();
- if (serverFeatures && !serverFeatures->haveVending())
+ if (serverFeatures &&
+ Net::getNetworkType() == ServerType::TMWATHENA)
+ {
mShop = ((flags & BeingFlag::SHOP) != 0);
+ }
mAway = ((flags & BeingFlag::AWAY) != 0);
mInactive = ((flags & BeingFlag::INACTIVE) != 0);
if (mShop || mAway || mInactive)
@@ -3330,7 +3333,7 @@ bool Being::updateFromCache() restrict2
}
else
{
- if (serverFeatures && !serverFeatures->haveVending())
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
mShop = false;
mAway = false;
mInactive = false;
@@ -3379,7 +3382,7 @@ void Being::addToCache() const restrict2
if (isAdvanced())
{
int flags = 0;
- if (serverFeatures && !serverFeatures->haveVending() && mShop)
+ if (Net::getNetworkType() == ServerType::TMWATHENA && mShop)
flags += BeingFlag::SHOP;
if (mAway)
flags += BeingFlag::AWAY;
@@ -4613,7 +4616,7 @@ void Being::setState(const uint8_t state) restrict2
const bool needUpdate = (shop != mShop || away != mAway
|| inactive != mInactive);
- if (!serverFeatures->haveVending())
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
mShop = shop;
mAway = away;
mInactive = inactive;
@@ -5133,12 +5136,14 @@ void Being::enableShop(const bool b) restrict2
bool Being::isBuyShopEnabled() const restrict2
{
- return mShop && (!serverFeatures->haveVending() || !mBuyBoard.empty());
+ return mShop && (Net::getNetworkType() == ServerType::TMWATHENA ||
+ !mBuyBoard.empty());
}
bool Being::isSellShopEnabled() const restrict2
{
- return mShop && (!serverFeatures->haveVending() || !mSellBoard.empty());
+ return mShop && (Net::getNetworkType() == ServerType::TMWATHENA ||
+ !mSellBoard.empty());
}
void Being::serverRemove() restrict2 noexcept2
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 81eb8f2c1..df69ffb38 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -2755,7 +2755,7 @@ void LocalPlayer::updateStatus() const
if (serverFeatures->havePlayerStatusUpdate() && mEnableAdvert)
{
uint8_t status = 0;
- if (!serverFeatures->haveVending())
+ if (Net::getNetworkType() == ServerType::TMWATHENA)
{
if (mTradebot && shopWindow && !shopWindow->isShopEmpty())
status |= BeingFlag::SHOP;
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index b1110c615..2082cbebf 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2705,7 +2705,8 @@ void PopupMenu::addBuySell(const Being *const being)
if (player_relations.getDefault() & PlayerRelation::TRADE)
{
mBrowserBox->addRow("##3---");
- const bool haveVending = serverFeatures->haveVending();
+ const bool haveVending =
+ (Net::getNetworkType() == ServerType::EATHENA);
if (being->isSellShopEnabled())
{
// TRANSLATORS: popup menu item
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 0de38a084..28260ce92 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -70,6 +70,7 @@
#endif // TMWA_SUPPORT
#include "net/buyingstorehandler.h"
#include "net/vendinghandler.h"
+#include "net/net.h"
#include "net/serverfeatures.h"
#ifdef TMWA_SUPPORT
#include "net/tradehandler.h"
@@ -140,7 +141,7 @@ ShopWindow::ShopWindow() :
mSellShopSize(0),
mBuyShopSize(0),
isBuySelected(true),
- mHaveVending(serverFeatures->haveVending()),
+ mHaveVending(Net::getNetworkType() == ServerType::EATHENA),
mEnableBuyingStore(false),
mEnableVending(false)
{
diff --git a/src/net/eathena/serverfeatures.cpp b/src/net/eathena/serverfeatures.cpp
index 4b20bee56..013dccde4 100644
--- a/src/net/eathena/serverfeatures.cpp
+++ b/src/net/eathena/serverfeatures.cpp
@@ -116,11 +116,6 @@ bool ServerFeatures::haveCreateCharGender() const
return serverVersion > 0;
}
-bool ServerFeatures::haveVending() const
-{
- return true;
-}
-
bool ServerFeatures::haveCart() const
{
return true;
diff --git a/src/net/eathena/serverfeatures.h b/src/net/eathena/serverfeatures.h
index 53536c404..c55ab46a0 100644
--- a/src/net/eathena/serverfeatures.h
+++ b/src/net/eathena/serverfeatures.h
@@ -66,8 +66,6 @@ class ServerFeatures final : public Net::ServerFeatures
bool haveCreateCharGender() const override final;
- bool haveVending() const override final A_CONST;
-
bool haveCart() const override final A_CONST;
bool haveCards() const override final A_CONST;
diff --git a/src/net/serverfeatures.h b/src/net/serverfeatures.h
index a1a614743..3aee1b19d 100644
--- a/src/net/serverfeatures.h
+++ b/src/net/serverfeatures.h
@@ -68,8 +68,6 @@ class ServerFeatures notfinal
virtual bool haveCreateCharGender() const = 0;
- virtual bool haveVending() const = 0;
-
virtual bool haveCart() const = 0;
virtual bool haveCards() const = 0;
diff --git a/src/net/tmwa/serverfeatures.cpp b/src/net/tmwa/serverfeatures.cpp
index 7a438db36..ddb843c1f 100644
--- a/src/net/tmwa/serverfeatures.cpp
+++ b/src/net/tmwa/serverfeatures.cpp
@@ -114,11 +114,6 @@ bool ServerFeatures::haveCreateCharGender() const
return tmwServerVersion > 0x0f0b17;
}
-bool ServerFeatures::haveVending() const
-{
- return false;
-}
-
bool ServerFeatures::haveCart() const
{
return false;
diff --git a/src/net/tmwa/serverfeatures.h b/src/net/tmwa/serverfeatures.h
index 57b89a57d..9ed734724 100644
--- a/src/net/tmwa/serverfeatures.h
+++ b/src/net/tmwa/serverfeatures.h
@@ -66,8 +66,6 @@ class ServerFeatures final : public Net::ServerFeatures
bool haveCreateCharGender() const override final;
- bool haveVending() const override final A_CONST;
-
bool haveCart() const override final A_CONST;
bool haveCards() const override final A_CONST;