diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-01-10 00:07:12 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-01-10 00:07:12 +0200 |
commit | c674793a8657aa099c9637c92f8696f230c327ca (patch) | |
tree | c5e8a8903aae7f4548fb7ce7f74e6c62b328059a /src/net | |
parent | ef1a9531d3e48d2035ece3571b9fa1b537aedca2 (diff) | |
download | mv-c674793a8657aa099c9637c92f8696f230c327ca.tar.gz mv-c674793a8657aa099c9637c92f8696f230c327ca.tar.bz2 mv-c674793a8657aa099c9637c92f8696f230c327ca.tar.xz mv-c674793a8657aa099c9637c92f8696f230c327ca.zip |
Add persistent ip as connection option.
Usefull is player using some kind of port mapping.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 10 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 5 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index e500f667b..4bf9df8b3 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -160,7 +160,15 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) PlayerInfo::setCharId(msg.readInt32()); GameHandler *gh = static_cast<GameHandler*>(Net::getGameHandler()); gh->setMap(msg.readString(16)); - mapServer.hostname = ipToString(msg.readInt32()); + if (config.getBoolValue("usePersistentIP")) + { + msg.readInt32(); + mapServer.hostname = Client::getServerName(); + } + else + { + mapServer.hostname = ipToString(msg.readInt32()); + } mapServer.port = msg.readInt16(); // Prevent the selected local player from being deleted diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 73fec1322..05a28513c 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -288,7 +288,10 @@ void LoginHandler::chooseServer(unsigned int server) return; charServer.clear(); - charServer.hostname = ipToString(mWorlds[server]->address); + if (config.getBoolValue("usePersistentIP")) + charServer.hostname = Client::getServerName(); + else + charServer.hostname = ipToString(mWorlds[server]->address); charServer.port = mWorlds[server]->port; Client::setState(STATE_UPDATE); |