Browse Source

engine: server: remove duplicate function

pull/2/head
Alibek Omarov 2 years ago
parent
commit
dd881d3da9
  1. 2
      engine/server/server.h
  2. 2
      engine/server/sv_client.c
  3. 39
      engine/server/sv_main.c

2
engine/server/server.h

@ -474,7 +474,6 @@ void SV_SendResource( resource_t *pResource, sizebuf_t *msg ); @@ -474,7 +474,6 @@ void SV_SendResource( resource_t *pResource, sizebuf_t *msg );
void SV_SendResourceList( sv_client_t *cl );
void SV_AddToMaster( netadr_t from, sizebuf_t *msg );
qboolean SV_ProcessUserAgent( netadr_t from, const char *useragent );
int SV_GetConnectedClientsCount( int *bots );
void Host_SetServerState( int state );
qboolean SV_IsSimulating( void );
void SV_FreeClients( void );
@ -551,6 +550,7 @@ void SV_InitClientMove( void ); @@ -551,6 +550,7 @@ void SV_InitClientMove( void );
void SV_UpdateServerInfo( void );
void SV_EndRedirect( void );
void SV_RejectConnection( netadr_t from, const char *fmt, ... ) _format( 2 );
void SV_GetPlayerCount( int *clients, int *bots );
//
// sv_cmds.c

2
engine/server/sv_client.c

@ -48,7 +48,7 @@ SV_GetPlayerCount @@ -48,7 +48,7 @@ SV_GetPlayerCount
=================
*/
static void SV_GetPlayerCount( int *players, int *bots )
void SV_GetPlayerCount( int *players, int *bots )
{
int i;

39
engine/server/sv_main.c

@ -163,41 +163,6 @@ qboolean SV_HasActivePlayers( void ) @@ -163,41 +163,6 @@ qboolean SV_HasActivePlayers( void )
return false;
}
/*
================
SV_GetConnectedClientsCount
returns connected clients count (and optionally bots count)
================
*/
int SV_GetConnectedClientsCount(int *bots)
{
int index;
int clients;
clients = 0;
if( svs.clients )
{
if( bots )
*bots = 0;
for( index = 0; index < svs.maxclients; index++ )
{
if( svs.clients[index].state >= cs_connected )
{
if( FBitSet( svs.clients[index].flags, FCL_FAKECLIENT ))
{
if( bots )
(*bots)++;
}
else
clients++;
}
}
}
return clients;
}
/*
===================
SV_UpdateMovevars
@ -777,7 +742,7 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg ) @@ -777,7 +742,7 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg )
{
uint challenge;
char s[MAX_INFO_STRING] = "0\n"; // skip 2 bytes of header
int clients = 0, bots = 0;
int clients, bots;
int len = sizeof( s );
if( !NET_IsMasterAdr( from ))
@ -786,7 +751,7 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg ) @@ -786,7 +751,7 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg )
return;
}
clients = SV_GetConnectedClientsCount( &bots );
SV_GetPlayerCount( &clients, &bots );
challenge = MSG_ReadUBitLong( msg, sizeof( uint ) << 3 );
Info_SetValueForKey( s, "protocol", va( "%d", PROTOCOL_VERSION ), len ); // protocol version

Loading…
Cancel
Save