From 919097c1635b11a925c452037dbfc901b56ed94a Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Sun, 23 Aug 2015 18:13:34 +0300
Subject: Move receive code from battlegroundhandler into separate file.

---
 src/CMakeLists.txt                      |  2 +
 src/Makefile.am                         |  2 +
 src/net/eathena/battleground.cpp        | 89 +++++++++++++++++++++++++++++++++
 src/net/eathena/battleground.h          | 44 ++++++++++++++++
 src/net/eathena/battlegroundhandler.cpp | 76 ++++------------------------
 src/net/eathena/battlegroundhandler.h   | 17 -------
 6 files changed, 146 insertions(+), 84 deletions(-)
 create mode 100644 src/net/eathena/battleground.cpp
 create mode 100644 src/net/eathena/battleground.h

(limited to 'src')

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3c493e5d5..176c01c65 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1526,6 +1526,8 @@ SET(SRCS_EATHENA
     net/eathena/bank.h
     net/eathena/bankhandler.cpp
     net/eathena/bankhandler.h
+    net/eathena/battleground.cpp
+    net/eathena/battleground.h
     net/eathena/battlegroundhandler.cpp
     net/eathena/battlegroundhandler.h
     net/eathena/cashshophandler.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index ec8fae76d..381e6ab69 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1372,6 +1372,8 @@ manaplus_SOURCES += gui/windows/bankwindow.cpp \
 	      net/eathena/bank.h \
 	      net/eathena/bankhandler.cpp \
 	      net/eathena/bankhandler.h \
+	      net/eathena/battleground.cpp \
+	      net/eathena/battleground.h \
 	      net/eathena/battlegroundhandler.cpp \
 	      net/eathena/battlegroundhandler.h \
 	      net/eathena/cashshophandler.cpp \
diff --git a/src/net/eathena/battleground.cpp b/src/net/eathena/battleground.cpp
new file mode 100644
index 000000000..730b19f24
--- /dev/null
+++ b/src/net/eathena/battleground.cpp
@@ -0,0 +1,89 @@
+/*
+ *  The ManaPlus Client
+ *  Copyright (C) 2011-2015  The ManaPlus Developers
+ *
+ *  This file is part of The ManaPlus Client.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "net/eathena/battleground.h"
+
+#include "logger.h"
+
+#include "debug.h"
+
+namespace EAthena
+{
+
+void BattleGround::processBattleEmblem(Net::MessageIn &msg)
+{
+    UNIMPLIMENTEDPACKET;
+    msg.readBeingId("account id");
+    msg.readString(24, "name");
+    msg.readInt16("camp");
+}
+
+void BattleGround::processBattleUpdateScore(Net::MessageIn &msg)
+{
+    UNIMPLIMENTEDPACKET;
+    msg.readInt16("camp a points");
+    msg.readInt16("camp b points");
+}
+
+void BattleGround::processBattleUpdateCoords(Net::MessageIn &msg)
+{
+    UNIMPLIMENTEDPACKET;
+    msg.readBeingId("account id");
+    msg.readString(24, "name");
+    msg.readInt16("class");
+    msg.readInt16("x");
+    msg.readInt16("y");
+}
+
+void BattleGround::processBattlePlay(Net::MessageIn &msg)
+{
+    UNIMPLIMENTEDPACKET;
+    msg.readString(24, "battle ground name");
+}
+
+void BattleGround::processBattleQueueAck(Net::MessageIn &msg)
+{
+    UNIMPLIMENTEDPACKET;
+    msg.readUInt8("type");
+    msg.readString(24, "bg name");
+}
+
+void BattleGround::processBattleBegins(Net::MessageIn &msg)
+{
+    UNIMPLIMENTEDPACKET;
+    msg.readString(24, "bg name");
+    msg.readString(24, "game name");
+}
+
+void BattleGround::processBattleNoticeDelete(Net::MessageIn &msg)
+{
+    UNIMPLIMENTEDPACKET;
+    msg.readUInt8("type");
+    msg.readString(24, "bg name");
+}
+
+void BattleGround::processBattleJoined(Net::MessageIn &msg)
+{
+    UNIMPLIMENTEDPACKET;
+    msg.readString(24, "name");
+    msg.readInt32("position");
+}
+
+}  // namespace EAthena
diff --git a/src/net/eathena/battleground.h b/src/net/eathena/battleground.h
new file mode 100644
index 000000000..1653abe0a
--- /dev/null
+++ b/src/net/eathena/battleground.h
@@ -0,0 +1,44 @@
+/*
+ *  The ManaPlus Client
+ *  Copyright (C) 2011-2015  The ManaPlus Developers
+ *
+ *  This file is part of The ManaPlus Client.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NET_EATHENA_BATTLEGROUND_H
+#define NET_EATHENA_BATTLEGROUND_H
+
+#ifdef EATHENA_SUPPORT
+
+#include "net/eathena/messagehandler.h"
+
+namespace EAthena
+{
+    namespace BattleGround
+    {
+        void processBattleEmblem(Net::MessageIn &msg);
+        void processBattleUpdateScore(Net::MessageIn &msg);
+        void processBattleUpdateCoords(Net::MessageIn &msg);
+        void processBattlePlay(Net::MessageIn &msg);
+        void processBattleQueueAck(Net::MessageIn &msg);
+        void processBattleBegins(Net::MessageIn &msg);
+        void processBattleNoticeDelete(Net::MessageIn &msg);
+        void processBattleJoined(Net::MessageIn &msg);
+    }  // namespace BattleGround
+}  // namespace EAthena
+
+#endif  // EATHENA_SUPPORT
+#endif  // NET_EATHENA_BATTLEGROUND_H
diff --git a/src/net/eathena/battlegroundhandler.cpp b/src/net/eathena/battlegroundhandler.cpp
index 3a59b495e..daa7a1bb2 100644
--- a/src/net/eathena/battlegroundhandler.cpp
+++ b/src/net/eathena/battlegroundhandler.cpp
@@ -22,6 +22,7 @@
 
 #include "logger.h"
 
+#include "net/eathena/battleground.h"
 #include "net/eathena/messageout.h"
 #include "net/eathena/protocol.h"
 
@@ -56,35 +57,35 @@ void BattleGroundHandler::handleMessage(Net::MessageIn &msg)
     switch (msg.getId())
     {
         case SMSG_BATTLE_EMBLEM:
-            processBattleEmblem(msg);
+            BattleGround::processBattleEmblem(msg);
             break;
 
         case SMSG_BATTLE_UPDATE_SCORE:
-            processBattleUpdateScore(msg);
+            BattleGround::processBattleUpdateScore(msg);
             break;
 
         case SMSG_BATTLE_UPDATE_COORDS:
-            processBattleUpdateCoords(msg);
+            BattleGround::processBattleUpdateCoords(msg);
             break;
 
         case SMSG_BATTLE_PLAY:
-            processBattlePlay(msg);
+            BattleGround::processBattlePlay(msg);
             break;
 
         case SMSG_BATTLE_QUEUE_ACK:
-            processBattleQueueAck(msg);
+            BattleGround::processBattleQueueAck(msg);
             break;
 
         case SMSG_BATTLE_BEGINS:
-            processBattleBegins(msg);
+            BattleGround::processBattleBegins(msg);
             break;
 
         case SMSG_BATTLE_NOTICE_DELETE:
-            processBattleNoticeDelete(msg);
+            BattleGround::processBattleNoticeDelete(msg);
             break;
 
         case SMSG_BATTLE_JOINED:
-            processBattleJoined(msg);
+            BattleGround::processBattleJoined(msg);
             break;
 
         default:
@@ -92,65 +93,6 @@ void BattleGroundHandler::handleMessage(Net::MessageIn &msg)
     }
 }
 
-void BattleGroundHandler::processBattleEmblem(Net::MessageIn &msg)
-{
-    UNIMPLIMENTEDPACKET;
-    msg.readBeingId("account id");
-    msg.readString(24, "name");
-    msg.readInt16("camp");
-}
-
-void BattleGroundHandler::processBattleUpdateScore(Net::MessageIn &msg)
-{
-    UNIMPLIMENTEDPACKET;
-    msg.readInt16("camp a points");
-    msg.readInt16("camp b points");
-}
-
-void BattleGroundHandler::processBattleUpdateCoords(Net::MessageIn &msg)
-{
-    UNIMPLIMENTEDPACKET;
-    msg.readBeingId("account id");
-    msg.readString(24, "name");
-    msg.readInt16("class");
-    msg.readInt16("x");
-    msg.readInt16("y");
-}
-
-void BattleGroundHandler::processBattlePlay(Net::MessageIn &msg)
-{
-    UNIMPLIMENTEDPACKET;
-    msg.readString(24, "battle ground name");
-}
-
-void BattleGroundHandler::processBattleQueueAck(Net::MessageIn &msg)
-{
-    UNIMPLIMENTEDPACKET;
-    msg.readUInt8("type");
-    msg.readString(24, "bg name");
-}
-
-void BattleGroundHandler::processBattleBegins(Net::MessageIn &msg)
-{
-    UNIMPLIMENTEDPACKET;
-    msg.readString(24, "bg name");
-    msg.readString(24, "game name");
-}
-
-void BattleGroundHandler::processBattleNoticeDelete(Net::MessageIn &msg)
-{
-    UNIMPLIMENTEDPACKET;
-    msg.readUInt8("type");
-    msg.readString(24, "bg name");
-}
-
-void BattleGroundHandler::processBattleJoined(Net::MessageIn &msg)
-{
-    UNIMPLIMENTEDPACKET;
-    msg.readString(24, "name");
-    msg.readInt32("position");
-}
-
 void BattleGroundHandler::registerBg(const BattleGroundTypeT &type,
                                      const std::string &name) const
 {
diff --git a/src/net/eathena/battlegroundhandler.h b/src/net/eathena/battlegroundhandler.h
index 3490331c7..cbc6a39fa 100644
--- a/src/net/eathena/battlegroundhandler.h
+++ b/src/net/eathena/battlegroundhandler.h
@@ -49,23 +49,6 @@ class BattleGroundHandler final : public MessageHandler,
                       const std::string &gameName) const override final;
 
         void checkState(const std::string &name) const override final;
-
-    protected:
-        void processBattleEmblem(Net::MessageIn &msg);
-
-        void processBattleUpdateScore(Net::MessageIn &msg);
-
-        void processBattleUpdateCoords(Net::MessageIn &msg);
-
-        void processBattlePlay(Net::MessageIn &msg);
-
-        void processBattleQueueAck(Net::MessageIn &msg);
-
-        void processBattleBegins(Net::MessageIn &msg);
-
-        void processBattleNoticeDelete(Net::MessageIn &msg);
-
-        void processBattleJoined(Net::MessageIn &msg);
 };
 
 }  // namespace EAthena
-- 
cgit v1.2.3-70-g09d2