summaryrefslogtreecommitdiff
path: root/src/net/eathena/charserverhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-30 01:46:52 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-30 16:37:02 +0300
commit3bea3e2804fbec4c7697d29af46c6330b1ca9b92 (patch)
treed39688b6fdfc42f63f3155ed2c0f19a5bafecc1a /src/net/eathena/charserverhandler.cpp
parent509c746b147458bcc94c2d66932b5bb89175c732 (diff)
downloadmanaverse-3bea3e2804fbec4c7697d29af46c6330b1ca9b92.tar.gz
manaverse-3bea3e2804fbec4c7697d29af46c6330b1ca9b92.tar.bz2
manaverse-3bea3e2804fbec4c7697d29af46c6330b1ca9b92.tar.xz
manaverse-3bea3e2804fbec4c7697d29af46c6330b1ca9b92.zip
Remove additional parameters from processCharMapInfo function.
Diffstat (limited to 'src/net/eathena/charserverhandler.cpp')
-rw-r--r--src/net/eathena/charserverhandler.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 58b757e3f..d46728fac 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -24,6 +24,7 @@
#include "client.h"
#include "configuration.h"
+#include "settings.h"
#include "being/attributes.h"
@@ -32,6 +33,7 @@
#include "net/net.h"
#include "net/eathena/attrs.h"
+#include "net/eathena/gamehandler.h"
#include "net/eathena/loginhandler.h"
#include "net/eathena/messageout.h"
#include "net/eathena/network.h"
@@ -105,7 +107,7 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_CHAR_MAP_INFO:
- processCharMapInfo(msg, mNetwork, mapServer);
+ processCharMapInfo(msg);
break;
case SMSG_CHANGE_MAP_SERVER:
@@ -298,4 +300,39 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg)
client->setState(STATE_CHAR_SELECT);
}
+void CharServerHandler::processCharMapInfo(Net::MessageIn &restrict msg)
+{
+ Network *const network = mNetwork;
+ ServerInfo &server = mapServer;
+ BLOCK_START("CharServerHandler::processCharMapInfo")
+// msg.skip(4); // CharID, must be the same as localPlayer->charID
+ PlayerInfo::setCharId(msg.readInt32());
+ GameHandler *const gh = static_cast<GameHandler*>(Net::getGameHandler());
+ gh->setMap(msg.readString(16));
+ if (config.getBoolValue("usePersistentIP") || settings.persistentIp)
+ {
+ msg.readInt32();
+ server.hostname = settings.serverName;
+ }
+ else
+ {
+ server.hostname = ipToString(msg.readInt32());
+ }
+ server.port = msg.readInt16();
+
+ // Prevent the selected local player from being deleted
+ localPlayer = mSelectedCharacter->dummy;
+ PlayerInfo::setBackend(mSelectedCharacter->data);
+
+ mSelectedCharacter->dummy = nullptr;
+
+ Net::getCharServerHandler()->clear();
+ updateCharSelectDialog();
+
+ if (network)
+ network->disconnect();
+ client->setState(STATE_CONNECT_GAME);
+ BLOCK_END("CharServerHandler::processCharMapInfo")
+}
+
} // namespace EAthena