mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-08 05:11:51 +08:00
Network extensions
This commit is contained in:
@@ -252,6 +252,7 @@ typedef struct sv_client_s
|
||||
|
||||
int challenge; // challenge of this user, randomly generated
|
||||
int userid; // identifying number on server
|
||||
int extensions;
|
||||
} sv_client_t;
|
||||
|
||||
/*
|
||||
|
||||
@@ -108,7 +108,12 @@ int SV_GetFragmentSize( void *pcl, fragsize_t mode )
|
||||
cl_frag_size = bound( FRAGMENT_MIN_SIZE, cl_frag_size, FRAGMENT_MAX_SIZE );
|
||||
|
||||
if( mode != FRAGSIZE_FRAG )
|
||||
return cl_frag_size;
|
||||
{
|
||||
if( cl->extensions & NET_EXT_SPLITSIZE )
|
||||
return cl_frag_size;
|
||||
else
|
||||
return 0; // original engine behaviour
|
||||
}
|
||||
|
||||
// get in-game fragmentation size
|
||||
if( cl->state == cs_spawned )
|
||||
@@ -266,6 +271,7 @@ void SV_ConnectClient( netadr_t from )
|
||||
int i, count = 0;
|
||||
int challenge;
|
||||
const char *s;
|
||||
int extensions;
|
||||
|
||||
if( Cmd_Argc() < 5 )
|
||||
{
|
||||
@@ -307,6 +313,9 @@ void SV_ConnectClient( netadr_t from )
|
||||
return;
|
||||
}
|
||||
|
||||
extensions = Q_atoi( Info_ValueForKey( protinfo, "ext" ) );
|
||||
|
||||
|
||||
// LAN servers restrict to class b IP addresses
|
||||
if( !SV_CheckIPRestrictions( from ))
|
||||
{
|
||||
@@ -369,6 +378,7 @@ void SV_ConnectClient( netadr_t from )
|
||||
newcl->frames = (client_frame_t *)Z_Calloc( sizeof( client_frame_t ) * SV_UPDATE_BACKUP );
|
||||
newcl->userid = g_userid++; // create unique userid
|
||||
newcl->state = cs_connected;
|
||||
newcl->extensions = extensions & (NET_EXT_SPLITSIZE);
|
||||
|
||||
// reset viewentities (from previous level)
|
||||
memset( newcl->viewentity, 0, sizeof( newcl->viewentity ));
|
||||
@@ -379,8 +389,15 @@ void SV_ConnectClient( netadr_t from )
|
||||
Netchan_Setup( NS_SERVER, &newcl->netchan, from, qport, newcl, SV_GetFragmentSize );
|
||||
MSG_Init( &newcl->datagram, "Datagram", newcl->datagram_buf, sizeof( newcl->datagram_buf )); // datagram buf
|
||||
|
||||
Q_strncpy( newcl->hashedcdkey, Info_ValueForKey( protinfo, "uuid" ), 32 );
|
||||
newcl->hashedcdkey[32] = '\0';
|
||||
|
||||
// build protinfo answer
|
||||
protinfo[0] = '\0';
|
||||
Info_SetValueForKey( protinfo, "ext", va( "%d",newcl->extensions ), sizeof( protinfo ) );
|
||||
|
||||
// send the connect packet to the client
|
||||
Netchan_OutOfBandPrint( NS_SERVER, from, "client_connect" );
|
||||
Netchan_OutOfBandPrint( NS_SERVER, from, "client_connect %s", protinfo );
|
||||
|
||||
newcl->upstate = us_inactive;
|
||||
newcl->connection_started = host.realtime;
|
||||
@@ -388,8 +405,7 @@ void SV_ConnectClient( netadr_t from )
|
||||
newcl->delta_sequence = -1;
|
||||
newcl->flags = 0;
|
||||
|
||||
Q_strncpy( newcl->hashedcdkey, Info_ValueForKey( protinfo, "uuid" ), 32 );
|
||||
newcl->hashedcdkey[32] = '\0';
|
||||
|
||||
|
||||
// reset any remaining events
|
||||
memset( &newcl->events, 0, sizeof( newcl->events ));
|
||||
|
||||
Reference in New Issue
Block a user