Don't use net_port as port to connect to

the connect commands supports adding the port with ":"
like "connect 10.1.2.3:27016" - if no port is set, it defaults to 27015

net_port is still used as the port to listen on and to send from.
This commit is contained in:
Daniel Gibson 2013-03-16 01:20:35 +01:00
parent b38aff8995
commit d5898abfa4
2 changed files with 8 additions and 5 deletions

View file

@ -388,7 +388,7 @@ void idSessionLocalWin::Connect_f( const idCmdArgs& args )
{
if( args.Argc() < 2 )
{
idLib::Printf( "Usage: Connect to IP. Use with net_port. \n" );
idLib::Printf( "Usage: Connect to IP. Use IP:Port to specify port (e.g. 10.0.0.1:1234) \n" );
return;
}
@ -402,7 +402,10 @@ void idSessionLocalWin::Connect_f( const idCmdArgs& args )
lobbyConnectInfo_t connectInfo;
Sys_StringToNetAdr( args.Argv( 1 ), &connectInfo.netAddr, true );
connectInfo.netAddr.port = net_port.GetInteger(); // FIXME: really? what if it was specified in the connect cmd?
if( connectInfo.netAddr.port == 0 )
{
connectInfo.netAddr.port = 27015;
}
ConnectAndMoveToLobby( GetPartyLobby(), connectInfo, false );
}
@ -600,8 +603,7 @@ idSessionLocalWin::EnsurePort
*/
void idSessionLocalWin::EnsurePort()
{
// XXX: fucked up?
// Init the port using reqular windows sockets
// Init the port using reqular sockets
if( port.IsOpen() )
{
return; // Already initialized
@ -609,6 +611,7 @@ void idSessionLocalWin::EnsurePort()
if( port.InitPort( net_port.GetInteger(), false ) )
{
// TODO: what about canJoinLocalHost when running two instances with different net_port values?
canJoinLocalHost = false;
}
else

View file

@ -58,7 +58,7 @@ idCVar net_testPartyMemberConnectFail( "net_testPartyMemberConnectFail", "-1", C
//FIXME: this could use a better name.
idCVar net_offlineTransitionThreshold( "net_offlineTransitionThreshold", "1000", CVAR_INTEGER, "Time, in milliseconds, to wait before kicking back to the main menu when a profile losses backend connection during an online game" );
idCVar net_port( "net_port", "27015", CVAR_INTEGER, "host port number" ); // Port to host when using dedicated servers, port to broadcast on when looking for a dedicated server to connect to
idCVar net_port( "net_port", "27015", CVAR_INTEGER | CVAR_NOCHEAT, "host port number" ); // Port to host when using dedicated servers, port to broadcast on when looking for a dedicated server to connect to
idCVar net_headlessServer( "net_headlessServer", "0", CVAR_BOOL, "toggle to automatically host a game and allow peer[0] to control menus" );
const char* idSessionLocal::stateToString[ NUM_STATES ] =