summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-28 21:53:24 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-28 21:53:24 +0300
commit22bb94a2587fa16d808ec966f01d07dc27d9f5d9 (patch)
treec2b6cc27c3bb420c32e2d8bacdd8f1634f85e419 /src
parent510d030cbf0cca87e81801b1f484c24e8d4b7940 (diff)
downloadmv-22bb94a2587fa16d808ec966f01d07dc27d9f5d9.tar.gz
mv-22bb94a2587fa16d808ec966f01d07dc27d9f5d9.tar.bz2
mv-22bb94a2587fa16d808ec966f01d07dc27d9f5d9.tar.xz
mv-22bb94a2587fa16d808ec966f01d07dc27d9f5d9.zip
Build mercenaryhandler only if eathena enabled.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/Makefile.am8
-rw-r--r--src/actions/actions.cpp4
-rw-r--r--src/being/localplayer.cpp4
-rw-r--r--src/being/playerinfo.cpp6
-rw-r--r--src/being/playerinfo.h2
-rw-r--r--src/gui/popups/popupmenu.cpp2
-rw-r--r--src/net/mercenaryhandler.h3
-rw-r--r--src/net/net.cpp4
-rw-r--r--src/net/tmwa/generalhandler.cpp4
-rw-r--r--src/net/tmwa/mercenaryhandler.h3
11 files changed, 30 insertions, 16 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a00a4552e..f30364533 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -539,7 +539,6 @@ SET(SRCS
net/ea/inventoryitem.h
net/logindata.h
net/loginhandler.h
- net/mercenaryhandler.h
net/messagehandler.h
net/messagein.cpp
net/messagein.h
@@ -1336,8 +1335,6 @@ SET(SRCS_TMWA
net/tmwa/itemhandler.h
net/tmwa/loginhandler.cpp
net/tmwa/loginhandler.h
- net/tmwa/mercenaryhandler.cpp
- net/tmwa/mercenaryhandler.h
net/tmwa/messagehandler.cpp
net/tmwa/messagehandler.h
net/tmwa/messagein.cpp
@@ -1392,6 +1389,8 @@ SET(SRCS_TMWAEATHENA
net/tmwa/mailhandler.h
net/tmwa/markethandler.cpp
net/tmwa/markethandler.h
+ net/tmwa/mercenaryhandler.cpp
+ net/tmwa/mercenaryhandler.h
)
SET(SRCS_EATHENA
@@ -1425,6 +1424,7 @@ SET(SRCS_EATHENA
net/homunculushandler.h
net/mailhandler.h
net/markethandler.h
+ net/mercenaryhandler.h
net/eathena/adminhandler.cpp
net/eathena/adminhandler.h
net/eathena/auctionhandler.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index a5851cea7..d4815ed82 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -665,7 +665,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
net/ea/inventoryitem.h \
net/logindata.h \
net/loginhandler.h \
- net/mercenaryhandler.h \
net/messagehandler.h \
net/messagein.cpp \
net/messagein.h \
@@ -1267,8 +1266,6 @@ manaplus_SOURCES += \
net/tmwa/itemhandler.h \
net/tmwa/loginhandler.cpp \
net/tmwa/loginhandler.h \
- net/tmwa/mercenaryhandler.cpp \
- net/tmwa/mercenaryhandler.h \
net/tmwa/messagehandler.cpp \
net/tmwa/messagehandler.h \
net/tmwa/messagein.cpp \
@@ -1323,7 +1320,9 @@ manaplus_SOURCES += net/tmwa/auctionhandler.cpp \
net/tmwa/mailhandler.cpp \
net/tmwa/mailhandler.h \
net/tmwa/markethandler.cpp \
- net/tmwa/markethandler.h
+ net/tmwa/markethandler.h \
+ net/tmwa/mercenaryhandler.cpp \
+ net/tmwa/mercenaryhandler.h
endif
manaplus_CXXFLAGS += -DEATHENA_SUPPORT
@@ -1357,6 +1356,7 @@ manaplus_SOURCES += gui/windows/bankwindow.cpp \
net/homunculushandler.h \
net/mailhandler.h \
net/markethandler.h \
+ net/mercenaryhandler.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 f673d43b4..eab3a69a4 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -1426,8 +1426,12 @@ impHandler(uploadLog)
impHandler0(mercenaryFire)
{
+#ifdef EATHENA_SUPPORT
mercenaryHandler->fire();
return true;
+#else
+ return false;
+#endif
}
impHandler(useItem)
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 79f68dfbe..cd9b642f0 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -466,7 +466,9 @@ void LocalPlayer::nextTile(unsigned char dir A_UNUSED = 0)
Being::nextTile();
}
+#ifdef EATHENA_SUPPORT
PlayerInfo::updateMoveAI();
+#endif
}
bool LocalPlayer::pickUp(FloorItem *const item)
@@ -781,7 +783,9 @@ void LocalPlayer::attack(Being *const target, const bool keep,
const int targetId = target->getId();
playerHandler->attack(targetId, mServerAttack);
+#ifdef EATHENA_SUPPORT
PlayerInfo::updateAttackAi(targetId, mServerAttack);
+#endif
}
if (!keep)
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index a3eb640a9..dc7eb3732 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -559,25 +559,23 @@ int getMercenaryId()
return mMercenary ? mMercenary->id : 0;
}
+#ifdef EATHENA_SUPPORT
void updateMoveAI()
{
if (mMercenary)
mercenaryHandler->moveToMaster();
-#ifdef EATHENA_SUPPORT
if (mHomunculus)
homunculusHandler->moveToMaster();
-#endif
}
void updateAttackAi(const int targetId, const bool keep)
{
if (mMercenary)
mercenaryHandler->attack(targetId, keep);
-#ifdef EATHENA_SUPPORT
if (mHomunculus)
homunculusHandler->attack(targetId, keep);
-#endif
}
+#endif
void setGuildPositionFlags(const GuildPositionFlags::Type pos)
{
diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h
index 54c578163..49f4d54e5 100644
--- a/src/being/playerinfo.h
+++ b/src/being/playerinfo.h
@@ -263,9 +263,11 @@ namespace PlayerInfo
int getMercenaryId();
+#ifdef EATHENA_SUPPORT
void updateMoveAI();
void updateAttackAi(const int targetId, const bool keep);
+#endif
void setGuildPositionFlags(const GuildPositionFlags::Type pos);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 936e490a3..bedc93259 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1464,6 +1464,7 @@ void PopupMenu::handleLink(const std::string &link,
if (chat)
chatHandler->joinChat(chat, "");
}
+#ifdef EATHENA_SUPPORT
else if (link == "fire mercenary")
{
mercenaryHandler->fire();
@@ -1472,7 +1473,6 @@ void PopupMenu::handleLink(const std::string &link,
{
mercenaryHandler->moveToMaster();
}
-#ifdef EATHENA_SUPPORT
else if (link == "homunculus to master")
{
homunculusHandler->moveToMaster();
diff --git a/src/net/mercenaryhandler.h b/src/net/mercenaryhandler.h
index 857ecd035..40a92bbd7 100644
--- a/src/net/mercenaryhandler.h
+++ b/src/net/mercenaryhandler.h
@@ -21,6 +21,8 @@
#ifndef NET_MERCENARYHANDLER_H
#define NET_MERCENARYHANDLER_H
+#ifdef EATHENA_SUPPORT
+
#include <string>
#include "localconsts.h"
@@ -55,4 +57,5 @@ class MercenaryHandler notfinal
extern Net::MercenaryHandler *mercenaryHandler;
+#endif // EATHENA_SUPPORT
#endif // NET_MERCENARYHANDLER_H
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 7b7afd157..7b0d34d9a 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -51,6 +51,7 @@ namespace Net
class HomunculusHandler;
class MailHandler;
class MarketHandler;
+ class MercenaryHandler;
#endif
class AdminHandler;
class BeingHandler;
@@ -61,7 +62,6 @@ namespace Net
class GeneralHandler;
class GuildHandler;
class InventoryHandler;
- class MercenaryHandler;
class NpcHandler;
class PartyHandler;
class PetHandler;
@@ -91,7 +91,6 @@ Net::TradeHandler *tradeHandler = nullptr;
Net::BeingHandler *beingHandler = nullptr;
Net::BuySellHandler *buySellHandler = nullptr;
Net::ServerFeatures *serverFeatures = nullptr;
-Net::MercenaryHandler *mercenaryHandler = nullptr;
#ifdef EATHENA_SUPPORT
Net::AuctionHandler *auctionHandler = nullptr;
Net::BankHandler *bankHandler = nullptr;
@@ -103,6 +102,7 @@ Net::FriendsHandler *friendsHandler = nullptr;
Net::HomunculusHandler *homunculusHandler = nullptr;
Net::MailHandler *mailHandler = nullptr;
Net::MarketHandler *marketHandler = nullptr;
+Net::MercenaryHandler *mercenaryHandler = nullptr;
#endif
Net::QuestHandler *questHandler = nullptr;
Net::VendingHandler *vendingHandler = nullptr;
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 5acf3040c..9205db800 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -116,8 +116,8 @@ GeneralHandler::GeneralHandler() :
mHomunculusHandler(new HomunculusHandler),
mMailHandler(new MailHandler),
mMarketHandler(new MarketHandler),
-#endif
mMercenaryHandler(new MercenaryHandler),
+#endif
mVendingHandler(new VendingHandler),
mSearchStoreHandler(new SearchStoreHandler)
{
@@ -246,8 +246,8 @@ void GeneralHandler::load()
mNetwork->registerHandler(mHomunculusHandler);
mNetwork->registerHandler(mMailHandler);
mNetwork->registerHandler(mMarketHandler);
-#endif
mNetwork->registerHandler(mMercenaryHandler);
+#endif
mNetwork->registerHandler(mVendingHandler);
mNetwork->registerHandler(mSearchStoreHandler);
}
diff --git a/src/net/tmwa/mercenaryhandler.h b/src/net/tmwa/mercenaryhandler.h
index 5833ab68c..1d5a40b8a 100644
--- a/src/net/tmwa/mercenaryhandler.h
+++ b/src/net/tmwa/mercenaryhandler.h
@@ -21,6 +21,8 @@
#ifndef NET_TMWA_MERCENARYHANDLER_H
#define NET_TMWA_MERCENARYHANDLER_H
+#ifdef EATHENA_SUPPORT
+
#include "net/mercenaryhandler.h"
#include "net/tmwa/messagehandler.h"
@@ -57,4 +59,5 @@ class MercenaryHandler final : public MessageHandler,
} // namespace TmwAthena
+#endif // EATHENA_SUPPORT
#endif // NET_TMWA_MERCENARYHANDLER_H