diff --git a/client/Client.cpp b/client/Client.cpp index 347cad243..bd8b1f695 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -246,18 +246,25 @@ void CClient::endGame( bool closeConnection /*= true*/ ) #if 1 void CClient::loadGame(const std::string & fname, const bool server, const std::vector& humanplayerindices, const int loadNumPlayers, int player_, const std::string & ipaddr, const std::string & port) { - PlayerColor player(player_); //intentional shadowing + PlayerColor player(player_); //intentional shadowing + logNetwork->infoStream() << "Loading procedure started!"; - logNetwork->infoStream() <<"Loading procedure started!"; + std::string realPort; + if(settings["testing"]["enabled"].Bool()) + realPort = settings["testing"]["port"].String(); + else if(port.size()) + realPort = port; + else + realPort = boost::lexical_cast(settings["server"]["port"].Float()); CServerHandler sh; - if(server) - sh.startServer(); - else - serv = sh.justConnectToServer(ipaddr,port=="" ? "3030" : port); + if(server) + sh.startServer(); + else + serv = sh.justConnectToServer(ipaddr, realPort); CStopWatch tmh; - unique_ptr loader; + unique_ptr loader; try { std::string clientSaveName = *CResourceHandler::get("local")->getResourceName(ResourceID(fname, EResType::CLIENT_SAVEGAME)); @@ -967,7 +974,10 @@ CServerHandler::CServerHandler(bool runServer /*= false*/) { serverThread = nullptr; shared = nullptr; - port = boost::lexical_cast(settings["server"]["port"].Float()); + if(settings["testing"]["enabled"].Bool()) + port = settings["testing"]["port"].String(); + else + port = boost::lexical_cast(settings["server"]["port"].Float()); verbose = true; #ifndef VCMI_ANDROID