From 74b96285c2ad2f07af0af9f8926bcd5e253dcde9 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Thu, 25 Sep 2014 16:54:25 +0300
Subject: eathena: add packet CMSG_HOMMERC_MOVE_TO 0x0232.

---
 src/net/eathena/homunculushandler.cpp | 10 ++++++++++
 src/net/eathena/homunculushandler.h   |  2 ++
 src/net/eathena/mercenaryhandler.cpp  | 10 ++++++++++
 src/net/eathena/mercenaryhandler.h    |  2 ++
 src/net/eathena/protocol.h            |  1 +
 src/net/homunculushandler.h           |  2 ++
 src/net/mercenaryhandler.h            |  2 ++
 src/net/tmwa/homunculushandler.cpp    |  4 ++++
 src/net/tmwa/homunculushandler.h      |  2 ++
 src/net/tmwa/mercenaryhandler.cpp     |  4 ++++
 src/net/tmwa/mercenaryhandler.h       |  2 ++
 11 files changed, 41 insertions(+)

diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp
index 54c64cf59..320af387e 100644
--- a/src/net/eathena/homunculushandler.cpp
+++ b/src/net/eathena/homunculushandler.cpp
@@ -194,4 +194,14 @@ void HomunculusHandler::moveToMaster() const
     outMsg.writeInt32(id);
 }
 
+void HomunculusHandler::move(const int x, const int y) const
+{
+    const int id = PlayerInfo::getHomunculusId();
+    if (!id)
+        return;
+    createOutPacket(CMSG_HOMMERC_MOVE_TO);
+    outMsg.writeInt32(id);
+    outMsg.writeCoordinates(x, y, 0U);
+}
+
 }  // namespace EAthena
diff --git a/src/net/eathena/homunculushandler.h b/src/net/eathena/homunculushandler.h
index 627561655..01cb0586f 100644
--- a/src/net/eathena/homunculushandler.h
+++ b/src/net/eathena/homunculushandler.h
@@ -43,6 +43,8 @@ class HomunculusHandler final : public MessageHandler,
 
         void moveToMaster() const override final;
 
+        void move(const int x, const int y) const override final;
+
     protected:
         void processHomunculusSkills(Net::MessageIn &msg);
 
diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp
index dae3f1836..1ec3628a8 100644
--- a/src/net/eathena/mercenaryhandler.cpp
+++ b/src/net/eathena/mercenaryhandler.cpp
@@ -195,4 +195,14 @@ void MercenaryHandler::moveToMaster() const
     outMsg.writeInt32(id);
 }
 
+void MercenaryHandler::move(const int x, const int y) const
+{
+    const int id = PlayerInfo::getMercenaryId();
+    if (!id)
+        return;
+    createOutPacket(CMSG_HOMMERC_MOVE_TO);
+    outMsg.writeInt32(id);
+    outMsg.writeCoordinates(x, y, 0U);
+}
+
 }  // namespace EAthena
diff --git a/src/net/eathena/mercenaryhandler.h b/src/net/eathena/mercenaryhandler.h
index 197efdfc0..06fdd7cec 100644
--- a/src/net/eathena/mercenaryhandler.h
+++ b/src/net/eathena/mercenaryhandler.h
@@ -45,6 +45,8 @@ class MercenaryHandler final : public MessageHandler,
 
         void moveToMaster() const override final;
 
+        void move(const int x, const int y) const override final;
+
     protected:
         void processMercenaryUpdate(Net::MessageIn &msg);
 
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index 698bddf59..c1df2d1e6 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -419,6 +419,7 @@
 
 #define CMSG_HOMUNCULUS_SET_NAME     0x0231
 #define CMSG_HOMMERC_MOVE_TO_MASTER  0x0234
+#define CMSG_HOMMERC_MOVE_TO         0x0232
 
 #define CMSG_DORI_DORI               0x01e7
 #define CMSG_EXPLOSION_SPIRITS       0x01ed
diff --git a/src/net/homunculushandler.h b/src/net/homunculushandler.h
index 09ee9e48a..2d7bb7d0d 100644
--- a/src/net/homunculushandler.h
+++ b/src/net/homunculushandler.h
@@ -37,6 +37,8 @@ class HomunculusHandler notfinal
         virtual void setName(const std::string &name) const = 0;
 
         virtual void moveToMaster() const = 0;
+
+        virtual void move(const int x, const int y) const = 0;
 };
 
 }  // namespace Net
diff --git a/src/net/mercenaryhandler.h b/src/net/mercenaryhandler.h
index 85e72b02f..ef1f60a45 100644
--- a/src/net/mercenaryhandler.h
+++ b/src/net/mercenaryhandler.h
@@ -39,6 +39,8 @@ class MercenaryHandler notfinal
         virtual void fire() = 0;
 
         virtual void moveToMaster() const = 0;
+
+        virtual void move(const int x, const int y) const = 0;
 };
 
 }  // namespace Net
diff --git a/src/net/tmwa/homunculushandler.cpp b/src/net/tmwa/homunculushandler.cpp
index b0760454e..598aed30e 100644
--- a/src/net/tmwa/homunculushandler.cpp
+++ b/src/net/tmwa/homunculushandler.cpp
@@ -50,4 +50,8 @@ void HomunculusHandler::moveToMaster() const
 {
 }
 
+void HomunculusHandler::move(const int x A_UNUSED, const int y A_UNUSED) const
+{
+}
+
 }  // namespace TmwAthena
diff --git a/src/net/tmwa/homunculushandler.h b/src/net/tmwa/homunculushandler.h
index d5c4d1b72..41a3e3426 100644
--- a/src/net/tmwa/homunculushandler.h
+++ b/src/net/tmwa/homunculushandler.h
@@ -41,6 +41,8 @@ class HomunculusHandler final : public MessageHandler,
         void setName(const std::string &name) const override final;
 
         void moveToMaster() const override final;
+
+        void move(const int x, const int y) const override final;
 };
 
 }  // namespace TmwAthena
diff --git a/src/net/tmwa/mercenaryhandler.cpp b/src/net/tmwa/mercenaryhandler.cpp
index 64f91dc1a..de4ca5f7e 100644
--- a/src/net/tmwa/mercenaryhandler.cpp
+++ b/src/net/tmwa/mercenaryhandler.cpp
@@ -54,4 +54,8 @@ void MercenaryHandler::moveToMaster() const
 {
 }
 
+void MercenaryHandler::move(const int x A_UNUSED, const int y A_UNUSED) const
+{
+}
+
 }  // namespace TmwAthena
diff --git a/src/net/tmwa/mercenaryhandler.h b/src/net/tmwa/mercenaryhandler.h
index b9f8d9c07..e327247df 100644
--- a/src/net/tmwa/mercenaryhandler.h
+++ b/src/net/tmwa/mercenaryhandler.h
@@ -43,6 +43,8 @@ class MercenaryHandler final : public MessageHandler,
         void fire() override final;
 
         void moveToMaster() const override final;
+
+        void move(const int x, const int y) const override final;
 };
 
 }  // namespace TmwAthena
-- 
cgit v1.2.3-70-g09d2