summaryrefslogtreecommitdiff
path: root/src/net/tmwa/charserverhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-10 00:07:12 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-10 00:07:12 +0200
commitc674793a8657aa099c9637c92f8696f230c327ca (patch)
treec5e8a8903aae7f4548fb7ce7f74e6c62b328059a /src/net/tmwa/charserverhandler.cpp
parentef1a9531d3e48d2035ece3571b9fa1b537aedca2 (diff)
downloadmv-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/tmwa/charserverhandler.cpp')
-rw-r--r--src/net/tmwa/charserverhandler.cpp10
1 files changed, 9 insertions, 1 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