summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-16 13:13:48 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-16 13:13:48 +0300
commit5b8f189276b3883253de31d5e7bbbf897d34c85b (patch)
treec3e6028d800e4caf4acb7ca3f45ba2e63e8df26b
parent47d811c90a4655b69f1846c16150efebbfa4ccfa (diff)
downloadManaVerse-5b8f189276b3883253de31d5e7bbbf897d34c85b.tar.gz
ManaVerse-5b8f189276b3883253de31d5e7bbbf897d34c85b.tar.bz2
ManaVerse-5b8f189276b3883253de31d5e7bbbf897d34c85b.tar.xz
ManaVerse-5b8f189276b3883253de31d5e7bbbf897d34c85b.zip
Use guildmanager only if build with tmwa support.
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/Makefile.am8
-rw-r--r--src/actions/chat.cpp6
-rw-r--r--src/client.cpp2
-rw-r--r--src/game.cpp13
-rw-r--r--src/gui/popups/popupmenu.cpp12
-rw-r--r--src/gui/widgets/tabs/chat/emulateguildtab.h3
-rw-r--r--src/gui/windows/socialwindow.cpp8
-rw-r--r--src/guildmanager.h3
-rw-r--r--src/net/eathena/beinghandler.cpp12
-rw-r--r--src/notifymanager.cpp4
-rw-r--r--src/utils/chatutils.cpp2
12 files changed, 62 insertions, 19 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 902895b2c..8c22f1eb8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -172,8 +172,6 @@ SET(SRCS
gui/models/langlistmodel.h
gui/widgets/flowcontainer.cpp
gui/widgets/flowcontainer.h
- gui/widgets/tabs/chat/emulateguildtab.cpp
- gui/widgets/tabs/chat/emulateguildtab.h
gui/widgets/tabs/chat/gmtab.cpp
gui/widgets/tabs/chat/gmtab.h
gui/widgets/tabs/chat/guildtab.cpp
@@ -894,8 +892,6 @@ SET(SRCS
graphicsvertexes.h
guild.cpp
guild.h
- guildmanager.cpp
- guildmanager.h
enums/dragdropsource.h
enums/equipslot.h
enums/guildpositionflags.h
@@ -1336,6 +1332,10 @@ SET(SRCS_EVOL
)
SET(SRCS_TMWA
+ guildmanager.cpp
+ guildmanager.h
+ gui/widgets/tabs/chat/emulateguildtab.cpp
+ gui/widgets/tabs/chat/emulateguildtab.h
net/tmwa/adminhandler.cpp
net/tmwa/adminhandler.h
net/tmwa/auctionhandler.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index bf8353fb7..cc0d41bd6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -306,8 +306,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
gui/models/langlistmodel.h \
gui/widgets/flowcontainer.cpp \
gui/widgets/flowcontainer.h \
- gui/widgets/tabs/chat/emulateguildtab.cpp \
- gui/widgets/tabs/chat/emulateguildtab.h \
gui/widgets/tabs/chat/gmtab.cpp \
gui/widgets/tabs/chat/gmtab.h \
gui/widgets/guitable.cpp \
@@ -1025,8 +1023,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
graphicsvertexes.h \
guild.cpp \
guild.h \
- guildmanager.cpp \
- guildmanager.h \
enums/dragdropsource.h \
enums/equipslot.h \
enums/guildpositionflags.h \
@@ -1271,6 +1267,10 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
if ENABLE_TMWA
manaplus_CXXFLAGS += -DTMWA_SUPPORT
manaplus_SOURCES += \
+ guildmanager.cpp \
+ guildmanager.h \
+ gui/widgets/tabs/chat/emulateguildtab.cpp \
+ gui/widgets/tabs/chat/emulateguildtab.h \
net/tmwa/adminhandler.cpp \
net/tmwa/adminhandler.h \
net/tmwa/auctionhandler.cpp \
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index cacafea5b..5014b24bc 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -78,10 +78,12 @@ static void outString(ChatTab *const tab,
return;
guildHandler->chat(guild->getId(), str);
}
+#ifdef TMWA_SUPPORT
else if (guildManager)
{
guildManager->chat(str);
}
+#endif
}
break;
}
@@ -369,10 +371,14 @@ impHandler(guild)
const Guild *const guild = localPlayer->getGuild();
if (guild)
{
+#ifdef TMWA_SUPPORT
if (guild->getServerGuild())
guildHandler->invite(guild->getId(), args);
else if (guildManager)
guildManager->invite(args);
+#else
+ guildHandler->invite(guild->getId(), args);
+#endif
}
}
else
diff --git a/src/client.cpp b/src/client.cpp
index 198fadc1d..ab2606ea5 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -861,7 +861,9 @@ int Client::gameExec()
mumbleManager->setServer(mCurrentServer.hostname);
#endif
+#ifdef TMWA_SUPPORT
GuildManager::init();
+#endif
if (!mConfigAutoSaved)
{
diff --git a/src/game.cpp b/src/game.cpp
index df582af9f..1b67f6d90 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -141,7 +141,9 @@ static void initEngines()
{
actorManager = new ActorManager;
effectManager = new EffectManager;
+#ifdef TMWA_SUPPORT
GuildManager::init();
+#endif
particleEngine = new Particle();
particleEngine->setMap(nullptr);
@@ -305,9 +307,10 @@ static void destroyGuiWindows()
if (whoIsOnline)
whoIsOnline->setAllowUpdate(false);
+#ifdef TMWA_SUPPORT
if (guildManager)
guildManager->clear();
-
+#endif
delete2(windowMenu);
delete2(localChatTab) // Need to do this first, so it can remove itself
delete2(debugChatTab)
@@ -344,8 +347,10 @@ static void destroyGuiWindows()
delete2(whoIsOnline);
delete2(killStats);
+#ifdef TMWA_SUPPORT
if (guildManager && GuildManager::getEnableGuildBot())
guildManager->reload();
+#endif
}
Game *Game::mInstance = nullptr;
@@ -409,8 +414,10 @@ Game::Game() :
setupWindow->setInGame(true);
clearKeysArray();
+#ifdef TMWA_SUPPORT
if (guildManager && GuildManager::getEnableGuildBot())
guildManager->requestGuildInfo();
+#endif
if (localPlayer)
localPlayer->updatePets();
@@ -437,7 +444,9 @@ Game::~Game()
delete2(particleEngine)
delete2(viewport)
delete2(mCurrentMap)
+#ifdef TMWA_SUPPORT
delete2(guildManager)
+#endif
#ifdef USE_MUMBLE
delete2(mumbleManager)
#endif
@@ -616,8 +625,10 @@ void Game::slowLogic()
shopWindow->updateTimes();
if (mainGraphics->getOpenGL())
DelayedManager::delayedLoad();
+#ifdef TMWA_SUPPORT
if (guildManager)
guildManager->slowLogic();
+#endif
if (skillDialog)
skillDialog->slowLogic();
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index d596f1a50..9a998214f 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -214,8 +214,10 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being)
}
else
{
+#ifdef TMWA_SUPPORT
if (guild2->getServerGuild()
|| (guildManager && guildManager->havePower()))
+#endif
{
// TRANSLATORS: popup menu item
// TRANSLATORS: invite player to guild
@@ -492,8 +494,10 @@ void PopupMenu::showPlayerPopup(const std::string &nick)
{
if (guild2->getMember(mNick))
{
+#ifdef TMWA_SUPPORT
if (guild2->getServerGuild() || (guildManager
&& guildManager->havePower()))
+#endif
{
// TRANSLATORS: popup menu item
// TRANSLATORS: kick player from guild
@@ -509,8 +513,10 @@ void PopupMenu::showPlayerPopup(const std::string &nick)
}
else
{
+#ifdef TMWA_SUPPORT
if (guild2->getServerGuild() || (guildManager
&& guildManager->havePower()))
+#endif
{
// TRANSLATORS: popup menu item
// TRANSLATORS: invite player to guild
@@ -811,8 +817,10 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab)
{
if (guild1->getId() == guild2->getId())
{
+#ifdef TMWA_SUPPORT
if (guild2->getServerGuild() || (guildManager
&& guildManager->havePower()))
+#endif
{
// TRANSLATORS: popup menu item
// TRANSLATORS: kick player from guild
@@ -830,8 +838,10 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab)
}
else
{
+#ifdef TMWA_SUPPORT
if (guild2->getServerGuild() || (guildManager
&& guildManager->havePower()))
+#endif
{
// TRANSLATORS: popup menu item
// TRANSLATORS: invite player to guild
@@ -1059,8 +1069,10 @@ void PopupMenu::handleLink(const std::string &link,
{
if (guild->getServerGuild())
guildHandler->kick(guild->getMember(mNick), "");
+#ifdef TMWA_SUPPORT
else if (guildManager)
guildManager->kick(mNick);
+#endif
}
}
}
diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.h b/src/gui/widgets/tabs/chat/emulateguildtab.h
index d9cb18a28..8ff759c9c 100644
--- a/src/gui/widgets/tabs/chat/emulateguildtab.h
+++ b/src/gui/widgets/tabs/chat/emulateguildtab.h
@@ -23,6 +23,8 @@
#ifndef GUI_WIDGETS_TABS_CHAT_EMULATEGUILDTAB_H
#define GUI_WIDGETS_TABS_CHAT_EMULATEGUILDTAB_H
+#ifdef TMWA_SUPPORT
+
#include "gui/widgets/tabs/chat/chattab.h"
/**
@@ -53,4 +55,5 @@ class EmulateGuildTab final : public ChatTab,
void getAutoCompleteCommands(StringVect &names) const override final;
};
+#endif // TMWA_SUPPORT
#endif // GUI_WIDGETS_TABS_CHAT_EMULATEGUILDTAB_H
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index d742a0186..b359bc775 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -304,10 +304,14 @@ void SocialWindow::action(const ActionEvent &event)
strprintf(_("Accepted guild invite from %s."),
mPartyInviter.c_str()));
}
+#ifdef TMWA_SUPPORT
if (!guildManager || !GuildManager::getEnableGuildBot())
guildHandler->inviteResponse(mGuildInvited, true);
else
guildManager->inviteResponse(true);
+#else
+ guildHandler->inviteResponse(mGuildInvited, true);
+#endif
}
else if (eventId == "no")
{
@@ -318,10 +322,14 @@ void SocialWindow::action(const ActionEvent &event)
strprintf(_("Rejected guild invite from %s."),
mPartyInviter.c_str()));
}
+#ifdef TMWA_SUPPORT
if (!guildManager || !GuildManager::getEnableGuildBot())
guildHandler->inviteResponse(mGuildInvited, false);
else
guildManager->inviteResponse(false);
+#else
+ guildHandler->inviteResponse(mGuildInvited, false);
+#endif
}
mGuildInvited = 0;
diff --git a/src/guildmanager.h b/src/guildmanager.h
index a8c647fb6..2fa6b2df8 100644
--- a/src/guildmanager.h
+++ b/src/guildmanager.h
@@ -21,6 +21,8 @@
#ifndef GUILDMANAGER_H
#define GUILDMANAGER_H
+#ifdef TMWA_SUPPORT
+
#include "utils/stringvector.h"
#include "localconsts.h"
@@ -100,4 +102,5 @@ class GuildManager final
extern GuildManager *guildManager;
+#endif // TMWA_SUPPORT
#endif // GUILDMANAGER_H
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index e5116a612..301c90b93 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -1489,16 +1489,8 @@ void BeingHandler::processPlayerGuilPartyInfo(Net::MessageIn &msg)
{
dstBeing->setName(msg.readString(24, "char name"));
dstBeing->setPartyName(msg.readString(24, "party name"));
- if (!guildManager || !GuildManager::getEnableGuildBot())
- {
- dstBeing->setGuildName(msg.readString(24, "guild name"));
- dstBeing->setGuildPos(msg.readString(24, "guild pos"));
- }
- else
- {
- msg.readString(24, "guild name");
- msg.readString(24, "guild pos");
- }
+ dstBeing->setGuildName(msg.readString(24, "guild name"));
+ dstBeing->setGuildPos(msg.readString(24, "guild pos"));
dstBeing->addToCache();
}
BLOCK_END("BeingHandler::processPlayerGuilPartyInfo")
diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp
index 7cb4a9469..9c86be769 100644
--- a/src/notifymanager.cpp
+++ b/src/notifymanager.cpp
@@ -46,10 +46,14 @@ namespace NotifyManager
const Guild *const guild = localPlayer->getGuild();
if (guild)
{
+#ifdef TMWA_SUPPORT
if (guild->getServerGuild())
return guildHandler->getTab();
else if (guildManager)
return guildManager->getTab();
+#else
+ return guildHandler->getTab();
+#endif
}
return nullptr;
}
diff --git a/src/utils/chatutils.cpp b/src/utils/chatutils.cpp
index 7913d14c2..45130ced8 100644
--- a/src/utils/chatutils.cpp
+++ b/src/utils/chatutils.cpp
@@ -71,10 +71,12 @@ void outStringNormal(ChatTab *const tab,
return;
guildHandler->chat(guild->getId(), str);
}
+#ifdef TMWA_SUPPORT
else if (guildManager)
{
guildManager->chat(str);
}
+#endif
}
break;
}