mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'gentlemen-ping-fix' into 'master'
Don't show ping if no one else is racing See merge request KartKrew/Kart!277
This commit is contained in:
commit
b7582007fa
3 changed files with 34 additions and 1 deletions
|
|
@ -5754,6 +5754,18 @@ INT32 D_NumPlayers(void)
|
|||
return num;
|
||||
}
|
||||
|
||||
/** Return whether a player is a real person (not a CPU) and not spectating.
|
||||
*/
|
||||
boolean D_IsPlayerHumanAndGaming (INT32 player_number)
|
||||
{
|
||||
player_t * player = &players[player_number];
|
||||
return (
|
||||
playeringame[player_number] &&
|
||||
! player->spectator &&
|
||||
! player->bot
|
||||
);
|
||||
}
|
||||
|
||||
tic_t GetLag(INT32 node)
|
||||
{
|
||||
return gametic - nettics[node];
|
||||
|
|
|
|||
|
|
@ -637,6 +637,7 @@ extern UINT8 playernode[MAXPLAYERS];
|
|||
extern UINT8 playerconsole[MAXPLAYERS];
|
||||
|
||||
INT32 D_NumPlayers(void);
|
||||
boolean D_IsPlayerHumanAndGaming(INT32 player_number);
|
||||
void D_ResetTiccmds(void);
|
||||
|
||||
tic_t GetLag(INT32 node);
|
||||
|
|
|
|||
|
|
@ -1375,6 +1375,8 @@ static inline boolean I_SkipFrame(void)
|
|||
//
|
||||
void I_FinishUpdate(void)
|
||||
{
|
||||
int player;
|
||||
|
||||
if (rendermode == render_none)
|
||||
return; //Alam: No software or OpenGl surface
|
||||
|
||||
|
|
@ -1389,7 +1391,25 @@ void I_FinishUpdate(void)
|
|||
if (cv_showping.value && netgame &&
|
||||
( consoleplayer != serverplayer || ! server_lagless ))
|
||||
{
|
||||
SCR_DisplayLocalPing();
|
||||
if (server_lagless)
|
||||
{
|
||||
if (consoleplayer != serverplayer)
|
||||
SCR_DisplayLocalPing();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (
|
||||
player = 1;
|
||||
player < MAXPLAYERS;
|
||||
player++
|
||||
){
|
||||
if (D_IsPlayerHumanAndGaming(player))
|
||||
{
|
||||
SCR_DisplayLocalPing();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue