From ed5325ebc95fd9d954730a27c0e57be35bc5d3d0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Sep 2014 00:42:35 +0300 Subject: Move processMapLogin from ea to tmwa and eathena namespaces. --- src/net/ea/gamehandler.cpp | 18 ------------------ src/net/ea/gamehandler.h | 2 -- src/net/eathena/gamehandler.cpp | 18 ++++++++++++++++++ src/net/eathena/gamehandler.h | 3 +++ src/net/tmwa/gamehandler.cpp | 18 ++++++++++++++++++ src/net/tmwa/gamehandler.h | 3 +++ 6 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 653a014c7..cce62c1af 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -58,24 +58,6 @@ void GameHandler::setMap(const std::string &map) mMap = map.substr(0, map.rfind(".")); } -void GameHandler::processMapLogin(Net::MessageIn &msg) const -{ - unsigned char direction; - uint16_t x, y; - msg.readInt32(); // server tick - msg.readCoordinates(x, y, direction); - msg.skip(2); // 0x0505 - logger->log("Protocol: Player start position: (%d, %d)," - " Direction: %d", x, y, direction); - - mLastHost &= 0xffffff; - - // Switch now or we'll have problems - client->setState(STATE_GAME); - if (localPlayer) - localPlayer->setTileCoords(x, y); -} - void GameHandler::processWhoAnswer(Net::MessageIn &msg) const { NotifyManager::notify(NotifyTypes::ONLINE_USERS, msg.readInt32()); diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index a10b244c7..68de36c70 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -50,8 +50,6 @@ class GameHandler notfinal : public Net::GameHandler virtual bool canUseMagicBar() const override final A_WARN_UNUSED { return true; } - virtual void processMapLogin(Net::MessageIn &msg) const; - virtual void processWhoAnswer(Net::MessageIn &msg) const; virtual void processCharSwitchResponse(Net::MessageIn &msg) const; diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp index 31c883158..0da88d8b4 100644 --- a/src/net/eathena/gamehandler.cpp +++ b/src/net/eathena/gamehandler.cpp @@ -176,4 +176,22 @@ void GameHandler::processMapAccountId(Net::MessageIn &msg) msg.readInt32("account id"); } +void GameHandler::processMapLogin(Net::MessageIn &msg) const +{ + unsigned char direction; + uint16_t x, y; + msg.readInt32(); // server tick + msg.readCoordinates(x, y, direction); + msg.skip(2); // 0x0505 + logger->log("Protocol: Player start position: (%d, %d)," + " Direction: %d", x, y, direction); + + mLastHost &= 0xffffff; + + // Switch now or we'll have problems + client->setState(STATE_GAME); + if (localPlayer) + localPlayer->setTileCoords(x, y); +} + } // namespace EAthena diff --git a/src/net/eathena/gamehandler.h b/src/net/eathena/gamehandler.h index 56af1979b..c6b222f0c 100644 --- a/src/net/eathena/gamehandler.h +++ b/src/net/eathena/gamehandler.h @@ -57,6 +57,9 @@ class GameHandler final : public MessageHandler, public Ea::GameHandler bool mustPing() const override final A_WARN_UNUSED { return true; } + + protected: + void processMapLogin(Net::MessageIn &msg) const; }; } // namespace EAthena diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index fabd15b1b..e74315b44 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -171,4 +171,22 @@ void GameHandler::disconnect2() const MessageOut outMsg(CMSG_CLIENT_DISCONNECT); } +void GameHandler::processMapLogin(Net::MessageIn &msg) const +{ + unsigned char direction; + uint16_t x, y; + msg.readInt32(); // server tick + msg.readCoordinates(x, y, direction); + msg.skip(2); // 0x0505 + logger->log("Protocol: Player start position: (%d, %d)," + " Direction: %d", x, y, direction); + + mLastHost &= 0xffffff; + + // Switch now or we'll have problems + client->setState(STATE_GAME); + if (localPlayer) + localPlayer->setTileCoords(x, y); +} + } // namespace TmwAthena diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h index fdbb4cf17..b3736289e 100644 --- a/src/net/tmwa/gamehandler.h +++ b/src/net/tmwa/gamehandler.h @@ -55,6 +55,9 @@ class GameHandler final : public MessageHandler, public Ea::GameHandler bool mustPing() const override final A_WARN_UNUSED { return false; } + + protected: + void processMapLogin(Net::MessageIn &msg) const; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2