mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-14 00:40:46 +00:00
Merge branch 'ping-fix' into 'next'
Ping-related code fix Somehow, the part of the netcode for calculating the players' pings in a netgame frequently gets the concepts of nodes and players mixed up, which is probably not a good thing. This branch of course fixes those slipups. I originally based this branch on master to be merged to it (since it only fixed issues on the host's side), but after finding another issue with clients receiving PT_PING from the server, I decided to make this a merge to next instead. See merge request !193
This commit is contained in:
commit
abf92e965c
1 changed files with 7 additions and 12 deletions
|
@ -3971,7 +3971,7 @@ FILESTAMP
|
||||||
if (client)
|
if (client)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
for (i = 0; i < MAXNETNODES; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
if (playeringame[i])
|
if (playeringame[i])
|
||||||
playerpingtable[i] = (tic_t)netbuffer->u.pingtable[i];
|
playerpingtable[i] = (tic_t)netbuffer->u.pingtable[i];
|
||||||
}
|
}
|
||||||
|
@ -4529,8 +4529,8 @@ static inline void PingUpdate(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//send out our ping packets
|
//send out our ping packets
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXNETNODES; i++)
|
||||||
if (playeringame[i])
|
if (nodeingame[i])
|
||||||
HSendPacket(i, true, 0, sizeof(INT32) * MAXPLAYERS);
|
HSendPacket(i, true, 0, sizeof(INT32) * MAXPLAYERS);
|
||||||
|
|
||||||
pingmeasurecount = 1; //Reset count
|
pingmeasurecount = 1; //Reset count
|
||||||
|
@ -4560,20 +4560,15 @@ void NetUpdate(void)
|
||||||
|
|
||||||
gametime = nowtime;
|
gametime = nowtime;
|
||||||
|
|
||||||
if (!(gametime % 255) && netgame && server)
|
|
||||||
{
|
|
||||||
#ifdef NEWPING
|
|
||||||
PingUpdate();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef NEWPING
|
#ifdef NEWPING
|
||||||
if (server)
|
if (server)
|
||||||
{
|
{
|
||||||
|
if (netgame && !(gametime % 255))
|
||||||
|
PingUpdate();
|
||||||
// update node latency values so we can take an average later.
|
// update node latency values so we can take an average later.
|
||||||
for (i = 0; i < MAXNETNODES; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
if (playeringame[i])
|
if (playeringame[i])
|
||||||
realpingtable[i] += G_TicsToMilliseconds(GetLag(i));
|
realpingtable[i] += G_TicsToMilliseconds(GetLag(playernode[i]));
|
||||||
pingmeasurecount++;
|
pingmeasurecount++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue