engine: added changeport parameter for NET_Config

This commit is contained in:
SNMetamorph 2022-07-10 02:04:13 +04:00 committed by a1batross
parent fbdfed84be
commit 8f91830997
6 changed files with 12 additions and 12 deletions

View File

@ -3323,7 +3323,7 @@ NetAPI_InitNetworking
*/ */
void GAME_EXPORT NetAPI_InitNetworking( void ) void GAME_EXPORT NetAPI_InitNetworking( void )
{ {
NET_Config( true ); // allow remote NET_Config( true, false ); // allow remote
} }
/* /*

View File

@ -1298,7 +1298,7 @@ void CL_Rcon_f( void )
message[3] = (char)255; message[3] = (char)255;
message[4] = 0; message[4] = 0;
NET_Config( true ); // allow remote NET_Config( true, false ); // allow remote
Q_strcat( message, "rcon " ); Q_strcat( message, "rcon " );
Q_strcat( message, rcon_client_password->string ); Q_strcat( message, rcon_client_password->string );
@ -1561,7 +1561,7 @@ void CL_LocalServers_f( void )
netadr_t adr; netadr_t adr;
Con_Printf( "Scanning for servers on the local network area...\n" ); Con_Printf( "Scanning for servers on the local network area...\n" );
NET_Config( true ); // allow remote NET_Config( true, true ); // allow remote
// send a broadcast packet // send a broadcast packet
adr.type = NA_BROADCAST; adr.type = NA_BROADCAST;
@ -1583,7 +1583,7 @@ void CL_InternetServers_f( void )
char *info = fullquery + sizeof( MS_SCAN_REQUEST ) - 1; char *info = fullquery + sizeof( MS_SCAN_REQUEST ) - 1;
const size_t remaining = sizeof( fullquery ) - sizeof( MS_SCAN_REQUEST ); const size_t remaining = sizeof( fullquery ) - sizeof( MS_SCAN_REQUEST );
NET_Config( true ); // allow remote NET_Config( true, true ); // allow remote
Con_Printf( "Scanning for servers on the internet area...\n" ); Con_Printf( "Scanning for servers on the internet area...\n" );
Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining ); Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining );
@ -2152,7 +2152,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
} }
else if( clgame.request_type == NET_REQUEST_GAMEUI ) else if( clgame.request_type == NET_REQUEST_GAMEUI )
{ {
NET_Config( true ); // allow remote NET_Config( true, false ); // allow remote
Netchan_OutOfBandPrint( NS_CLIENT, servadr, "info %i", PROTOCOL_VERSION ); Netchan_OutOfBandPrint( NS_CLIENT, servadr, "info %i", PROTOCOL_VERSION );
} }
} }

View File

@ -1570,7 +1570,7 @@ NET_Config
A single player game will only use the loopback code A single player game will only use the loopback code
==================== ====================
*/ */
void NET_Config( qboolean multiplayer ) void NET_Config( qboolean multiplayer, qboolean changeport )
{ {
static qboolean bFirst = true; static qboolean bFirst = true;
static qboolean old_config; static qboolean old_config;
@ -1756,7 +1756,7 @@ void NET_Shutdown( void )
NET_ClearLagData( true, true ); NET_ClearLagData( true, true );
NET_Config( false ); NET_Config( false, false );
#if XASH_WIN32 #if XASH_WIN32
WSACleanup(); WSACleanup();
#endif #endif

View File

@ -51,7 +51,7 @@ void NET_Shutdown( void );
void NET_Sleep( int msec ); void NET_Sleep( int msec );
qboolean NET_IsActive( void ); qboolean NET_IsActive( void );
qboolean NET_IsConfigured( void ); qboolean NET_IsConfigured( void );
void NET_Config( qboolean net_enable ); void NET_Config( qboolean net_enable, qboolean changeport );
qboolean NET_IsLocalAddress( netadr_t adr ); qboolean NET_IsLocalAddress( netadr_t adr );
const char *NET_AdrToString( const netadr_t a ); const char *NET_AdrToString( const netadr_t a );
const char *NET_BaseAdrToString( const netadr_t a ); const char *NET_BaseAdrToString( const netadr_t a );

View File

@ -761,7 +761,7 @@ void SV_SetupClients( void )
Con_Reportf( "%s alloced by server packet entities\n", Q_memprint( sizeof( entity_state_t ) * svs.num_client_entities )); Con_Reportf( "%s alloced by server packet entities\n", Q_memprint( sizeof( entity_state_t ) * svs.num_client_entities ));
// init network stuff // init network stuff
NET_Config(( svs.maxclients > 1 )); NET_Config(( svs.maxclients > 1 ), true );
svgame.numEntities = svs.maxclients + 1; // clients + world svgame.numEntities = svs.maxclients + 1; // clients + world
ClearBits( sv_maxclients->flags, FCVAR_CHANGED ); ClearBits( sv_maxclients->flags, FCVAR_CHANGED );
} }

View File

@ -715,7 +715,7 @@ void Master_Add( void )
{ {
netadr_t adr; netadr_t adr;
NET_Config( true ); // allow remote NET_Config( true, false ); // allow remote
if( !NET_StringToAdr( MASTERSERVER_ADR, &adr )) if( !NET_StringToAdr( MASTERSERVER_ADR, &adr ))
Con_Printf( "can't resolve adr: %s\n", MASTERSERVER_ADR ); Con_Printf( "can't resolve adr: %s\n", MASTERSERVER_ADR );
@ -758,7 +758,7 @@ void Master_Shutdown( void )
{ {
netadr_t adr; netadr_t adr;
NET_Config( true ); // allow remote NET_Config( true, false ); // allow remote
if( !NET_StringToAdr( MASTERSERVER_ADR, &adr )) if( !NET_StringToAdr( MASTERSERVER_ADR, &adr ))
Con_Printf( "can't resolve addr: %s\n", MASTERSERVER_ADR ); Con_Printf( "can't resolve addr: %s\n", MASTERSERVER_ADR );
@ -1108,7 +1108,7 @@ void SV_Shutdown( const char *finalmsg )
if( public_server->value && svs.maxclients != 1 ) if( public_server->value && svs.maxclients != 1 )
Master_Shutdown(); Master_Shutdown();
NET_Config( false ); NET_Config( false, false );
SV_UnloadProgs (); SV_UnloadProgs ();
CL_Drop(); CL_Drop();