Browse Source

Write port override

nordsoft 3 years ago
parent
commit
27bff89e66
1 changed files with 10 additions and 4 deletions
  1. 10 4
      client/CServerHandler.cpp

+ 10 - 4
client/CServerHandler.cpp

@@ -278,10 +278,16 @@ void CServerHandler::justConnectToServer(const std::string & addr, const ui16 po
 
 
 	c->handler = std::make_shared<boost::thread>(&CServerHandler::threadHandleConnection, this);
 	c->handler = std::make_shared<boost::thread>(&CServerHandler::threadHandleConnection, this);
 
 
-	if(addr.empty() || addr == localhostAddress)
-		return;
-	Settings serverAddress = settings.write["server"]["server"];
-	serverAddress->String() = addr;
+	if(!addr.empty() && addr != localhostAddress)
+	{
+		Settings serverAddress = settings.write["server"]["server"];
+		serverAddress->String() = addr;
+	}
+	if(port && port != getDefaultPort())
+	{
+		Settings serverPort = settings.write["server"]["port"];
+		serverPort->Integer() = port;
+	}
 }
 }
 
 
 void CServerHandler::applyPacksOnLobbyScreen()
 void CServerHandler::applyPacksOnLobbyScreen()