Always use lan connection for connect-now
This commit is contained in:
12
src/main.cpp
12
src/main.cpp
@@ -587,7 +587,7 @@ void cmdLineHelp()
|
||||
" --server-password= Sets a password for a server (both client&server).\n"
|
||||
" --connect-now=ip Connect to a server with IP known now\n"
|
||||
" (in format x.x.x.x:xxx(port)), the port should be its\n"
|
||||
" server discovery port.\n"
|
||||
" private port.\n"
|
||||
" --login=s Automatically log in (set the login).\n"
|
||||
" --password=s Automatically log in (set the password).\n"
|
||||
" --port=n Port number to use.\n"
|
||||
@@ -1075,15 +1075,7 @@ int handleCmdLine()
|
||||
if (CommandLine::has("--connect-now", &s))
|
||||
{
|
||||
TransportAddress ip(s);
|
||||
if (ip.isLAN())
|
||||
{
|
||||
NetworkConfig::get()->setIsLAN();
|
||||
}
|
||||
else
|
||||
{
|
||||
NetworkConfig::get()->setIsWAN();
|
||||
NetworkConfig::get()->setDirectConnect(true);
|
||||
}
|
||||
NetworkConfig::get()->setIsLAN();
|
||||
NetworkConfig::get()->setIsServer(false);
|
||||
Log::info("main", "Try to connect to server '%s'.",
|
||||
ip.toString().c_str() );
|
||||
|
||||
@@ -43,7 +43,6 @@ NetworkConfig::NetworkConfig()
|
||||
m_is_server = false;
|
||||
m_is_public_server = false;
|
||||
m_max_players = 4;
|
||||
m_direct_connect = false;
|
||||
m_cur_user_id = 0;
|
||||
m_cur_user_token = "";
|
||||
m_server_name = "";
|
||||
|
||||
@@ -72,10 +72,6 @@ private:
|
||||
/** Maximum number of players on the server. */
|
||||
int m_max_players;
|
||||
|
||||
/** True if STK was started with connect-now argument, so it use direct
|
||||
* request-connection without using the addon server. */
|
||||
bool m_direct_connect;
|
||||
|
||||
/** True if a client should connect to the first server it finds and
|
||||
* immediately start a race. */
|
||||
bool m_auto_connect;
|
||||
@@ -207,10 +203,6 @@ public:
|
||||
std::pair<RaceManager::MinorRaceModeType, RaceManager::MajorRaceModeType>
|
||||
getLocalGameMode(unsigned);
|
||||
// ------------------------------------------------------------------------
|
||||
void setDirectConnect(bool val) { m_direct_connect = val; }
|
||||
// ------------------------------------------------------------------------
|
||||
bool isDirectConnect() const { return m_direct_connect; }
|
||||
// ------------------------------------------------------------------------
|
||||
void setCurrentUserId(uint32_t id) { m_cur_user_id = id ; }
|
||||
// ------------------------------------------------------------------------
|
||||
void setCurrentUserToken(const std::string& t) { m_cur_user_token = t; }
|
||||
|
||||
Reference in New Issue
Block a user