From e46cf607a4da55fc77b6b2ea7fca53d69ec6e56b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 30 Aug 2014 11:07:08 +0300 Subject: Remove additional parameters from processCharMapServer function. --- src/net/eathena/charserverhandler.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/net/eathena/charserverhandler.cpp') diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index d46728fac..5b3ccf79c 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -111,7 +111,7 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_CHANGE_MAP_SERVER: - processChangeMapServer(msg, mNetwork, mapServer); + processChangeMapServer(msg); break; default: @@ -335,4 +335,31 @@ void CharServerHandler::processCharMapInfo(Net::MessageIn &restrict msg) BLOCK_END("CharServerHandler::processCharMapInfo") } +void CharServerHandler::processChangeMapServer(Net::MessageIn &msg) +{ + Network *const network = mNetwork; + ServerInfo &server = mapServer; + BLOCK_START("CharServerHandler::processChangeMapServer") + GameHandler *const gh = static_cast(Net::getGameHandler()); + if (!gh || !network) + { + BLOCK_END("CharServerHandler::processChangeMapServer") + return; + } + gh->setMap(msg.readString(16)); + const int x = msg.readInt16(); + const int y = msg.readInt16(); + server.hostname = ipToString(msg.readInt32()); + server.port = msg.readInt16(); + + network->disconnect(); + client->setState(STATE_CHANGE_MAP); + if (localPlayer) + { + localPlayer->setTileCoords(x, y); + localPlayer->setMap(nullptr); + } + BLOCK_END("CharServerHandler::processChangeMapServer") +} + } // namespace EAthena -- cgit v1.2.3-60-g2f50