diff options
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 9 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.h | 2 |
4 files changed, 21 insertions, 4 deletions
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 7c5f5c88..a8e87622 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -158,7 +158,14 @@ void CharServerHandler::handleMessage(MessageIn &msg) msg.skip(4); // CharID, must be the same as local_player->charID GameHandler *gh = static_cast<GameHandler*>(Net::getGameHandler()); gh->setMap(msg.readString(16)); - mapServer.hostname = ipToString(msg.readInt32()); + + const auto ip = msg.readInt32(); + + if (charServer.persistentIp) + mapServer.hostname = charServer.hostname; + else + mapServer.hostname = ipToString(ip); + mapServer.port = msg.readInt16(); local_player = mSelectedCharacter->dummy; diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 77b545fd..2fbc02d4 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -274,7 +274,17 @@ void LoginHandler::chooseServer(unsigned int server) return; charServer.clear(); - charServer.hostname = ipToString(mWorlds[server]->address); + + if (mServer.persistentIp) + { + charServer.hostname = mServer.hostname; + charServer.persistentIp = mServer.persistentIp; + } + else + { + charServer.hostname = ipToString(mWorlds[server]->address); + } + charServer.port = mWorlds[server]->port; Client::setState(STATE_UPDATE); diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index ed564b46..5ff4f7e5 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -132,7 +132,7 @@ Network::~Network() SDLNet_Quit(); } -bool Network::connect(ServerInfo server) +bool Network::connect(const ServerInfo &server) { if (mState != IDLE && mState != NET_ERROR) { diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index 08943327..079e71ca 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -51,7 +51,7 @@ class Network ~Network(); - bool connect(ServerInfo server); + bool connect(const ServerInfo &server); void disconnect(); |