mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-29 16:24:16 +00:00
engine: server: fix bots are counted as real players
This commit is contained in:
parent
314672d82c
commit
6ef76fe665
@ -42,6 +42,35 @@ typedef struct ucmd_s
|
|||||||
|
|
||||||
static int g_userid = 1;
|
static int g_userid = 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
SV_GetPlayerCount
|
||||||
|
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
static void SV_GetPlayerCount( int *players, int *bots )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
*players = 0;
|
||||||
|
*bots = 0;
|
||||||
|
|
||||||
|
if( !svs.clients )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for( i = 0; i < svs.maxclients; i++ )
|
||||||
|
{
|
||||||
|
if( svs.clients[i].state >= cs_connected )
|
||||||
|
{
|
||||||
|
if( FBitSet( svs.clients[i].flags, FCL_FAKECLIENT ))
|
||||||
|
(*bots)++;
|
||||||
|
else
|
||||||
|
(*players)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
SV_GetChallenge
|
SV_GetChallenge
|
||||||
@ -835,12 +864,10 @@ void SV_Info( netadr_t from, int protocolVersion )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i, count = 0;
|
int i, count, bots;
|
||||||
qboolean havePassword = COM_CheckStringEmpty( sv_password.string );
|
qboolean havePassword = COM_CheckStringEmpty( sv_password.string );
|
||||||
|
|
||||||
for( i = 0; i < svs.maxclients; i++ )
|
SV_GetPlayerCount( &count, &bots );
|
||||||
if( svs.clients[i].state >= cs_connected )
|
|
||||||
count++;
|
|
||||||
|
|
||||||
// a1ba: send protocol version to distinguish old engine and new
|
// a1ba: send protocol version to distinguish old engine and new
|
||||||
Info_SetValueForKey( string, "p", va( "%i", PROTOCOL_VERSION ), MAX_INFO_STRING );
|
Info_SetValueForKey( string, "p", va( "%i", PROTOCOL_VERSION ), MAX_INFO_STRING );
|
||||||
@ -2163,22 +2190,11 @@ void SV_TSourceEngineQuery( netadr_t from )
|
|||||||
{
|
{
|
||||||
// A2S_INFO
|
// A2S_INFO
|
||||||
char answer[1024] = "";
|
char answer[1024] = "";
|
||||||
int count = 0, bots = 0;
|
int count, bots;
|
||||||
int index;
|
int index;
|
||||||
sizebuf_t buf;
|
sizebuf_t buf;
|
||||||
|
|
||||||
if( svs.clients )
|
SV_GetPlayerCount( &count, &bots );
|
||||||
{
|
|
||||||
for( index = 0; index < svs.maxclients; index++ )
|
|
||||||
{
|
|
||||||
if( svs.clients[index].state >= cs_connected )
|
|
||||||
{
|
|
||||||
if( FBitSet( svs.clients[index].flags, FCL_FAKECLIENT ))
|
|
||||||
bots++;
|
|
||||||
else count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MSG_Init( &buf, "TSourceEngineQuery", answer, sizeof( answer ));
|
MSG_Init( &buf, "TSourceEngineQuery", answer, sizeof( answer ));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user