From 2490ef610773ad1c7adf33a28b2fc982b2b8ee7e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 28 Feb 2015 22:56:32 +0300 Subject: Build vendinghandler only if eathena enabled. --- src/CMakeLists.txt | 6 +++--- src/Makefile.am | 10 +++++----- src/actions/actions.cpp | 2 ++ src/gui/windows/buydialog.cpp | 4 ++++ src/net/net.cpp | 4 ++-- src/net/tmwa/generalhandler.cpp | 8 +++++--- src/net/tmwa/generalhandler.h | 2 +- src/net/tmwa/vendinghandler.h | 3 +++ src/net/vendinghandler.h | 3 +++ 9 files changed, 28 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c836fb1ff..8dfba8410 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -563,7 +563,6 @@ SET(SRCS net/tradehandler.h enums/net/updatetype.h net/uploadcharinfo.h - net/vendinghandler.h net/worldinfo.h net/packetcounters.cpp net/packetcounters.h @@ -1362,8 +1361,6 @@ SET(SRCS_TMWA net/tmwa/sprite.h net/tmwa/tradehandler.cpp net/tmwa/tradehandler.h - net/tmwa/vendinghandler.cpp - net/tmwa/vendinghandler.h ) SET(SRCS_TMWAEATHENA @@ -1391,6 +1388,8 @@ SET(SRCS_TMWAEATHENA net/tmwa/mercenaryhandler.h net/tmwa/searchstorehandler.cpp net/tmwa/searchstorehandler.h + net/tmwa/vendinghandler.cpp + net/tmwa/vendinghandler.h ) SET(SRCS_EATHENA @@ -1426,6 +1425,7 @@ SET(SRCS_EATHENA net/markethandler.h net/mercenaryhandler.h net/searchstorehandler.h + net/vendinghandler.h net/eathena/adminhandler.cpp net/eathena/adminhandler.h net/eathena/auctionhandler.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 16b1edf98..df98c0428 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -690,7 +690,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ net/tradehandler.h \ enums/net/updatetype.h \ net/uploadcharinfo.h \ - net/vendinghandler.h \ net/worldinfo.h \ net/packetcounters.cpp \ net/packetcounters.h \ @@ -1291,9 +1290,7 @@ manaplus_SOURCES += \ net/tmwa/skillhandler.h \ net/tmwa/sprite.h \ net/tmwa/tradehandler.cpp \ - net/tmwa/tradehandler.h \ - net/tmwa/vendinghandler.cpp \ - net/tmwa/vendinghandler.h + net/tmwa/tradehandler.h endif if ENABLE_EATHENA @@ -1321,7 +1318,9 @@ manaplus_SOURCES += net/tmwa/auctionhandler.cpp \ net/tmwa/mercenaryhandler.cpp \ net/tmwa/mercenaryhandler.h \ net/tmwa/searchstorehandler.cpp \ - net/tmwa/searchstorehandler.h + net/tmwa/searchstorehandler.h \ + net/tmwa/vendinghandler.cpp \ + net/tmwa/vendinghandler.h endif manaplus_CXXFLAGS += -DEATHENA_SUPPORT @@ -1357,6 +1356,7 @@ manaplus_SOURCES += gui/windows/bankwindow.cpp \ net/markethandler.h \ net/mercenaryhandler.h \ net/searchstorehandler.h \ + net/vendinghandler.h \ net/eathena/adminhandler.cpp \ net/eathena/adminhandler.h \ net/eathena/auctionhandler.cpp \ diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index eab3a69a4..9f73f15ee 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -641,9 +641,11 @@ impHandler(buy) } else if (being->getType() == ActorType::Player) { +#ifdef EATHENA_SUPPORT if (serverFeatures->haveVending()) vendingHandler->open(being); else +#endif buySellHandler->requestSellList(being->getName()); return true; } diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index e404a335b..8c0f90466 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -477,6 +477,7 @@ void BuyDialog::action(const ActionEvent &event) } else if (mNpcId == Nick) { +#ifdef EATHENA_SUPPORT if (serverFeatures->haveVending()) { Being *const being = actorManager->findBeingByName(mNick); @@ -491,6 +492,9 @@ void BuyDialog::action(const ActionEvent &event) } } else if (tradeWindow) +#else + if (tradeWindow) +#endif { if (item) { diff --git a/src/net/net.cpp b/src/net/net.cpp index 326361b1c..fe06c4a63 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -53,6 +53,7 @@ namespace Net class MarketHandler; class MercenaryHandler; class SearchStoreHandler; + class VendingHandler; #endif class AdminHandler; class BeingHandler; @@ -71,7 +72,6 @@ namespace Net class ServerFeatures; class SkillHandler; class TradeHandler; - class VendingHandler; } // namespace Net Net::AdminHandler *adminHandler = nullptr; @@ -104,9 +104,9 @@ Net::MailHandler *mailHandler = nullptr; Net::MarketHandler *marketHandler = nullptr; Net::MercenaryHandler *mercenaryHandler = nullptr; Net::SearchStoreHandler *searchStoreHandler = nullptr; +Net::VendingHandler *vendingHandler = nullptr; #endif Net::QuestHandler *questHandler = nullptr; -Net::VendingHandler *vendingHandler = nullptr; namespace Net { diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 3326ae3e7..921b30f7a 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -104,8 +104,8 @@ GeneralHandler::GeneralHandler() : mSkillHandler(new SkillHandler), mTradeHandler(new TradeHandler), mQuestHandler(new QuestHandler), - mServerFeatures(new ServerFeatures), #ifdef EATHENA_SUPPORT + mServerFeatures(new ServerFeatures), mAuctionHandler(new AuctionHandler), mBankHandler(new BankHandler), mBuyingStoreHandler(new BuyingStoreHandler), @@ -118,8 +118,10 @@ GeneralHandler::GeneralHandler() : mMarketHandler(new MarketHandler), mMercenaryHandler(new MercenaryHandler), mSearchStoreHandler(new SearchStoreHandler), -#endif mVendingHandler(new VendingHandler) +#else + mServerFeatures(new ServerFeatures) +#endif { static const uint16_t _messages[] = { @@ -248,8 +250,8 @@ void GeneralHandler::load() mNetwork->registerHandler(mMarketHandler); mNetwork->registerHandler(mMercenaryHandler); mNetwork->registerHandler(mSearchStoreHandler); -#endif mNetwork->registerHandler(mVendingHandler); +#endif } void GeneralHandler::reload() diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index 69208b4db..6c30a5d65 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -93,9 +93,9 @@ class GeneralHandler final : public MessageHandler, MessageHandlerPtr mMailHandler; MessageHandlerPtr mMarketHandler; MessageHandlerPtr mSearchStoreHandler; + MessageHandlerPtr mVendingHandler; #endif MessageHandlerPtr mMercenaryHandler; - MessageHandlerPtr mVendingHandler; }; } // namespace TmwAthena diff --git a/src/net/tmwa/vendinghandler.h b/src/net/tmwa/vendinghandler.h index 22629be1f..ddfe72971 100644 --- a/src/net/tmwa/vendinghandler.h +++ b/src/net/tmwa/vendinghandler.h @@ -21,6 +21,8 @@ #ifndef NET_TMWA_VENDINGHANDLER_H #define NET_TMWA_VENDINGHANDLER_H +#ifdef EATHENA_SUPPORT + #include "net/vendinghandler.h" #include "net/tmwa/messagehandler.h" @@ -58,4 +60,5 @@ class VendingHandler final : public MessageHandler, } // namespace TmwAthena +#endif // EATHENA_SUPPORT #endif // NET_TMWA_VENDINGHANDLER_H diff --git a/src/net/vendinghandler.h b/src/net/vendinghandler.h index 797ef8340..ea6c4f551 100644 --- a/src/net/vendinghandler.h +++ b/src/net/vendinghandler.h @@ -21,6 +21,8 @@ #ifndef NET_VENDINGHANDLER_H #define NET_VENDINGHANDLER_H +#ifdef EATHENA_SUPPORT + #include #include @@ -60,4 +62,5 @@ class VendingHandler notfinal extern Net::VendingHandler *vendingHandler; +#endif // EATHENA_SUPPORT #endif // NET_VENDINGHANDLER_H -- cgit v1.2.3-70-g09d2