From d35d90b66e51679c6aabab6ef69217456d9c4f8b Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Mon, 6 Oct 2014 20:15:51 +0300
Subject: Move processGuildPositionInfo from ea namespace into eathena and
 tmwa.

---
 src/net/ea/guildhandler.cpp      | 37 -----------------------------------
 src/net/ea/guildhandler.h        |  2 --
 src/net/eathena/guildhandler.cpp | 42 ++++++++++++++++++++++++++++++++++++++++
 src/net/eathena/guildhandler.h   | 10 ++++++++--
 src/net/tmwa/guildhandler.cpp    | 42 ++++++++++++++++++++++++++++++++++++++++
 src/net/tmwa/guildhandler.h      |  9 ++++++++-
 6 files changed, 100 insertions(+), 42 deletions(-)

diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 598811fdd..3e43d6400 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -105,43 +105,6 @@ void GuildHandler::processGuildCreateResponse(Net::MessageIn &msg) const
     }
 }
 
-void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) const
-{
-    const int guildId =  msg.readInt32();
-    const int emblem =  msg.readInt32();
-    const int posMode =  msg.readInt32();
-    msg.readInt32();  // Unused
-    msg.readUInt8();  // Unused
-    std::string guildName = msg.readString(24);
-
-    Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId));
-    if (!g)
-        return;
-
-    g->setName(guildName);
-    g->setEmblemId(emblem);
-    if (!taGuild)
-        taGuild = g;
-    if (!guildTab && chatWindow)
-    {
-        guildTab = new GuildTab(chatWindow);
-        if (config.getBoolValue("showChatHistory"))
-            guildTab->loadFromLogFile("#Guild");
-        if (localPlayer)
-            localPlayer->addGuild(taGuild);
-        memberList(guildId);
-    }
-
-    if (localPlayer)
-    {
-        localPlayer->setGuild(g);
-        localPlayer->setGuildName(g->getName());
-    }
-
-    logger->log("Guild position info: %d %d %d %s\n", guildId,
-                emblem, posMode, guildName.c_str());
-}
-
 void GuildHandler::processGuildMemberLogin(Net::MessageIn &msg) const
 {
     const int accountId = msg.readInt32();  // Account ID
diff --git a/src/net/ea/guildhandler.h b/src/net/ea/guildhandler.h
index 48e5f325f..ed5453f7d 100644
--- a/src/net/ea/guildhandler.h
+++ b/src/net/ea/guildhandler.h
@@ -53,8 +53,6 @@ class GuildHandler notfinal : public Net::GuildHandler
 
         virtual void processGuildCreateResponse(Net::MessageIn &msg) const;
 
-        virtual void processGuildPositionInfo(Net::MessageIn &msg) const;
-
         virtual void processGuildMemberLogin(Net::MessageIn &msg) const;
 
         virtual void processGuildMasterOrMember(Net::MessageIn &msg) const;
diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp
index 27d848e74..03c5a34ef 100644
--- a/src/net/eathena/guildhandler.cpp
+++ b/src/net/eathena/guildhandler.cpp
@@ -22,10 +22,15 @@
 #include "net/eathena/guildhandler.h"
 
 #include "actormanager.h"
+#include "configuration.h"
 
 #include "being/localplayer.h"
 #include "being/playerinfo.h"
 
+#include "gui/windows/chatwindow.h"
+
+#include "net/ea/gui/guildtab.h"
+
 #include "net/eathena/messageout.h"
 #include "net/eathena/protocol.h"
 
@@ -348,4 +353,41 @@ void GuildHandler::checkMaster() const
     MessageOut msg(CMSG_GUILD_CHECK_MASTER);
 }
 
+void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) const
+{
+    const int guildId =  msg.readInt32();
+    const int emblem =  msg.readInt32();
+    const int posMode =  msg.readInt32();
+    msg.readInt32();  // Unused
+    msg.readUInt8();  // Unused
+    std::string guildName = msg.readString(24);
+
+    Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId));
+    if (!g)
+        return;
+
+    g->setName(guildName);
+    g->setEmblemId(emblem);
+    if (!Ea::taGuild)
+        Ea::taGuild = g;
+    if (!Ea::guildTab && chatWindow)
+    {
+        Ea::guildTab = new Ea::GuildTab(chatWindow);
+        if (config.getBoolValue("showChatHistory"))
+            Ea::guildTab->loadFromLogFile("#Guild");
+        if (localPlayer)
+            localPlayer->addGuild(Ea::taGuild);
+        memberList(guildId);
+    }
+
+    if (localPlayer)
+    {
+        localPlayer->setGuild(g);
+        localPlayer->setGuildName(g->getName());
+    }
+
+    logger->log("Guild position info: %d %d %d %s\n", guildId,
+                emblem, posMode, guildName.c_str());
+}
+
 }  // namespace EAthena
diff --git a/src/net/eathena/guildhandler.h b/src/net/eathena/guildhandler.h
index a32a398f5..c9beedc6b 100644
--- a/src/net/eathena/guildhandler.h
+++ b/src/net/eathena/guildhandler.h
@@ -75,10 +75,16 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler
 
     protected:
         void processGuildUpdateCoords(Net::MessageIn &msg) const;
+
+        void processGuildPositionInfo(Net::MessageIn &msg) const;
 };
 
-    extern Ea::GuildTab *guildTab;
-    extern Guild *taGuild;
+//    extern Ea::GuildTab *guildTab;
 }  // namespace EAthena
 
+namespace Ea
+{
+    extern Guild *taGuild;
+}
+
 #endif  // NET_EATHENA_GUILDHANDLER_H
diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp
index d6ee27680..9445a4760 100644
--- a/src/net/tmwa/guildhandler.cpp
+++ b/src/net/tmwa/guildhandler.cpp
@@ -22,12 +22,17 @@
 #include "net/tmwa/guildhandler.h"
 
 #include "actormanager.h"
+#include "configuration.h"
 
 #include "being/localplayer.h"
 #include "being/playerinfo.h"
 
+#include "gui/windows/chatwindow.h"
+
 #include "net/serverfeatures.h"
 
+#include "net/ea/gui/guildtab.h"
+
 #include "net/tmwa/messageout.h"
 #include "net/tmwa/protocol.h"
 
@@ -335,4 +340,41 @@ void GuildHandler::checkMaster() const
     MessageOut msg(CMSG_GUILD_CHECK_MASTER);
 }
 
+void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) const
+{
+    const int guildId =  msg.readInt32();
+    const int emblem =  msg.readInt32();
+    const int posMode =  msg.readInt32();
+    msg.readInt32();  // Unused
+    msg.readUInt8();  // Unused
+    std::string guildName = msg.readString(24);
+
+    Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId));
+    if (!g)
+        return;
+
+    g->setName(guildName);
+    g->setEmblemId(emblem);
+    if (!Ea::taGuild)
+        Ea::taGuild = g;
+    if (!Ea::guildTab && chatWindow)
+    {
+        Ea::guildTab = new Ea::GuildTab(chatWindow);
+        if (config.getBoolValue("showChatHistory"))
+            Ea::guildTab->loadFromLogFile("#Guild");
+        if (localPlayer)
+            localPlayer->addGuild(Ea::taGuild);
+        memberList(guildId);
+    }
+
+    if (localPlayer)
+    {
+        localPlayer->setGuild(g);
+        localPlayer->setGuildName(g->getName());
+    }
+
+    logger->log("Guild position info: %d %d %d %s\n", guildId,
+                emblem, posMode, guildName.c_str());
+}
+
 }  // namespace TmwAthena
diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h
index f1422c7a1..b92513919 100644
--- a/src/net/tmwa/guildhandler.h
+++ b/src/net/tmwa/guildhandler.h
@@ -72,10 +72,17 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler
                           const override final;
 
         void checkMaster() const;
+
+    protected:
+        void processGuildPositionInfo(Net::MessageIn &msg) const;
 };
 
     extern Ea::GuildTab *guildTab;
-    extern Guild *taGuild;
 }  // namespace TmwAthena
 
+namespace Ea
+{
+    extern Guild *taGuild;
+}
+
 #endif  // NET_TMWA_GUILDHANDLER_H
-- 
cgit v1.2.3-70-g09d2