mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-18 05:52:48 +00:00
HandleConnect handles bots
This commit is contained in:
parent
95fc311802
commit
1e40d08cec
1 changed files with 19 additions and 2 deletions
|
|
@ -4043,10 +4043,27 @@ static void HandleConnect(SINT8 node)
|
||||||
UINT8 maxplayers = min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxconnections.value);
|
UINT8 maxplayers = min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxconnections.value);
|
||||||
UINT8 connectedplayers = 0;
|
UINT8 connectedplayers = 0;
|
||||||
|
|
||||||
|
|
||||||
for (i = dedicated ? 1 : 0; i < MAXPLAYERS; i++)
|
for (i = dedicated ? 1 : 0; i < MAXPLAYERS; i++)
|
||||||
if (playernode[i] != UINT8_MAX) // We use this to count players because it is affected by SV_AddWaitingPlayers when more than one client joins on the same tic, unlike playeringame and D_NumPlayers. UINT8_MAX denotes no node for that player
|
{
|
||||||
|
// We use this to count players because it is affected by SV_AddWaitingPlayers when
|
||||||
|
// more than one client joins on the same tic, unlike playeringame and D_NumPlayers.
|
||||||
|
// UINT8_MAX denotes no node for that player.
|
||||||
|
|
||||||
|
if (playernode[i] != UINT8_MAX)
|
||||||
|
{
|
||||||
|
// Sal: This hack sucks, but it should be safe.
|
||||||
|
// playeringame is set for bots immediately; they are deterministic instead of a netxcmd.
|
||||||
|
// If a bot is added with netxcmd in the future, then the node check is still here too.
|
||||||
|
// So at worst, a theoretical netxcmd added bot will block real joiners for the time
|
||||||
|
// it takes for the command to process, but not cause any horrifying player overwriting.
|
||||||
|
if (playeringame[i] && players[i].bot)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
connectedplayers++;
|
connectedplayers++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
banrecord_t *ban = SV_GetBanByAddress(node);
|
banrecord_t *ban = SV_GetBanByAddress(node);
|
||||||
if (ban == NULL)
|
if (ban == NULL)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue