mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-01 06:00:45 +00:00
Merge branch 'fix-leftover-players-idle' into 'next'
Do not send disconnected players' statuses to the MS See merge request STJr/SRB2!2209
This commit is contained in:
commit
cbd6e397e3
3 changed files with 14 additions and 2 deletions
|
@ -1623,6 +1623,17 @@ INT32 D_NumPlayers(void)
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the number of nodes on the server.
|
||||||
|
*/
|
||||||
|
INT32 D_NumNodes(void)
|
||||||
|
{
|
||||||
|
INT32 num = 0;
|
||||||
|
for (INT32 ix = 0; ix < MAXNETNODES; ix++)
|
||||||
|
if (netnodes[ix].ingame)
|
||||||
|
num++;
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
/** Similar to the above, but counts only bots.
|
/** Similar to the above, but counts only bots.
|
||||||
* Purpose is to remove bots from both the player count and the
|
* Purpose is to remove bots from both the player count and the
|
||||||
* max player count on the server view
|
* max player count on the server view
|
||||||
|
|
|
@ -121,6 +121,7 @@ extern char motd[254], server_context[8];
|
||||||
extern UINT8 playernode[MAXPLAYERS];
|
extern UINT8 playernode[MAXPLAYERS];
|
||||||
|
|
||||||
INT32 D_NumPlayers(void);
|
INT32 D_NumPlayers(void);
|
||||||
|
INT32 D_NumNodes(void);
|
||||||
INT32 D_NumBots(void);
|
INT32 D_NumBots(void);
|
||||||
|
|
||||||
tic_t GetLag(INT32 node);
|
tic_t GetLag(INT32 node);
|
||||||
|
|
|
@ -109,7 +109,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||||
netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime);
|
netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime);
|
||||||
|
|
||||||
// Exclude bots from both counts
|
// Exclude bots from both counts
|
||||||
netbuffer->u.serverinfo.numberofplayer = (UINT8)(D_NumPlayers() - D_NumBots());
|
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumNodes();
|
||||||
netbuffer->u.serverinfo.maxplayer = (UINT8)(cv_maxplayers.value - D_NumBots());
|
netbuffer->u.serverinfo.maxplayer = (UINT8)(cv_maxplayers.value - D_NumBots());
|
||||||
|
|
||||||
netbuffer->u.serverinfo.refusereason = GetRefuseReason(node);
|
netbuffer->u.serverinfo.refusereason = GetRefuseReason(node);
|
||||||
|
@ -164,7 +164,7 @@ static void SV_SendPlayerInfo(INT32 node)
|
||||||
|
|
||||||
for (UINT8 i = 0; i < MAXPLAYERS; i++)
|
for (UINT8 i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (!playeringame[i])
|
if (playernode[i] == UINT8_MAX || !netnodes[playernode[i]].ingame)
|
||||||
{
|
{
|
||||||
netbuffer->u.playerinfo[i].num = 255; // This slot is empty.
|
netbuffer->u.playerinfo[i].num = 255; // This slot is empty.
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue