summaryrefslogtreecommitdiff
path: root/src/net/tmwa/charserverrecv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa/charserverrecv.cpp')
-rw-r--r--src/net/tmwa/charserverrecv.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp
index 6b8cf27c6..15f9ccdb7 100644
--- a/src/net/tmwa/charserverrecv.cpp
+++ b/src/net/tmwa/charserverrecv.cpp
@@ -207,15 +207,13 @@ void CharServerRecv::processCharMapInfo(Net::MessageIn &restrict msg)
BLOCK_START("CharServerRecv::processCharMapInfo")
PlayerInfo::setCharId(msg.readInt32("char id?"));
GameHandler::setMap(msg.readString(16, "map name"));
+
+ const int ipAddress = msg.readInt32("ip address");
if (config.getBoolValue("usePersistentIP") || settings.persistentIp)
- {
- msg.readInt32("ip address");
server.hostname = settings.serverName;
- }
else
- {
- server.hostname = ipToString(msg.readInt32("ip address"));
- }
+ server.hostname = ipToString(ipAddress);
+
server.port = msg.readInt16("port");
server.althostname = charServer.althostname;
@@ -247,15 +245,12 @@ void CharServerRecv::processChangeMapServer(Net::MessageIn &msg)
GameHandler::setMap(msg.readString(16, "map name"));
const int x = msg.readInt16("x");
const int y = msg.readInt16("y");
+ const int ipAddress = msg.readInt32("ip address");
if (config.getBoolValue("usePersistentIP") || settings.persistentIp)
- {
- msg.readInt32("ip address");
server.hostname = settings.serverName;
- }
else
- {
- server.hostname = ipToString(msg.readInt32("ip address"));
- }
+ server.hostname = ipToString(ipAddress);
+
server.port = msg.readInt16("port");
network->disconnect();