From 87eaa78ffd78bcbbf9850036e736e62d0319294a Mon Sep 17 00:00:00 2001 From: ArseniyShestakov Date: Sat, 19 Dec 2015 12:12:35 +0300 Subject: [PATCH] Restore testing option changes overriten by merge --- client/Client.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) 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