diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-04-12 14:46:06 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-04-12 15:15:37 -0600 |
commit | 612c842f32fec68ece4244ac672a1b889cf2eb18 (patch) | |
tree | 8682f225a4681e281505bd0f4c501be701228a9e /src/net/ea/gamehandler.cpp | |
parent | f30f3e6a51fc20bded8a3a04cd3a0f328a064469 (diff) | |
download | mana-client-612c842f32fec68ece4244ac672a1b889cf2eb18.tar.gz mana-client-612c842f32fec68ece4244ac672a1b889cf2eb18.tar.bz2 mana-client-612c842f32fec68ece4244ac672a1b889cf2eb18.tar.xz mana-client-612c842f32fec68ece4244ac672a1b889cf2eb18.zip |
Add support for map-server switching under eAthena
Also do some cleanup that's been needed for a while.
Reviewed-by: Bertram
Diffstat (limited to 'src/net/ea/gamehandler.cpp')
-rw-r--r-- | src/net/ea/gamehandler.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 3625b9ab..cabaf763 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -22,6 +22,7 @@ #include "net/ea/gamehandler.h" #include "client.h" +#include "game.h" #include "localplayer.h" #include "log.h" @@ -110,17 +111,22 @@ void GameHandler::connect() const Token &token = static_cast<LoginHandler*>(Net::getLoginHandler())->getToken(); + + if (Client::getState() == STATE_CONNECT_GAME) + { + mCharID = player_node->getId(); + // Change the player's ID to the account ID to match what eAthena uses + player_node->setId(token.account_ID); + } + // Send login infos MessageOut outMsg(CMSG_MAP_SERVER_CONNECT); outMsg.writeInt32(token.account_ID); - outMsg.writeInt32(player_node->getId()); + outMsg.writeInt32(mCharID); outMsg.writeInt32(token.session_ID1); outMsg.writeInt32(token.session_ID2); outMsg.writeInt8((token.sex == GENDER_MALE) ? 1 : 0); - // Change the player's ID to the account ID to match what eAthena uses - player_node->setId(token.account_ID); - // We get 4 useless bytes before the real answer comes in (what are these?) mNetwork->skip(4); } @@ -137,7 +143,7 @@ void GameHandler::disconnect() void GameHandler::inGame() { - // TODO + Game::instance()->changeMap(mMap); } void GameHandler::mapLoaded(const std::string &mapName) @@ -160,4 +166,9 @@ void GameHandler::ping(int tick) msg.writeInt32(tick); } +void GameHandler::setMap(const std::string map) +{ + mMap = map.substr(0, map.rfind(".")); +} + } // namespace EAthena |