Refactor code after review comments

This commit is contained in:
Gustaf Alhäll 2023-10-07 00:07:56 +02:00
parent a8fe500d0e
commit 436de21808
No known key found for this signature in database
GPG key ID: 6C1F67D690CDEDFD
3 changed files with 6 additions and 6 deletions

View file

@ -607,6 +607,7 @@ typedef struct player_s
tic_t jointime; // Timer when player joins game to change skin/color
tic_t quittime; // Time elapsed since user disconnected, zero if connected
tic_t lastinputtime; // the last tic the player has made any input
#ifdef HWRENDER
fixed_t fovadd; // adjust FOV for hw rendering
#endif

View file

@ -1282,19 +1282,19 @@ static void IdleUpdate(void)
for (i = 1; i < MAXPLAYERS; i++)
{
if (cv_idletime.value && playeringame[i] && playernode[i] != UINT8_MAX && !players[i].quittime && !players[i].spectator && i != serverplayer)
if (cv_idletime.value && playeringame[i] && playernode[i] != UINT8_MAX && !players[i].quittime && !players[i].spectator && !IsPlayerAdmin(i))
{
if (players[i].cmd.forwardmove || players[i].cmd.sidemove || players[i].cmd.buttons)
netnodes[i].lastinput = gametime;
players[i].lastinputtime = gametime;
if (gametime - netnodes[i].lastinput > cv_idletime.value * TICRATE)
if (gametime - players[i].lastinputtime > (tic_t)cv_idletime.value * TICRATE * 60)
{
netnodes[i].lastinput = gametime;
players[i].lastinputtime = gametime;
SendKick(i, KICK_MSG_IDLE | KICK_MSG_KEEP_BODY);
}
}
else
netnodes[i].lastinput = gametime;
players[i].lastinputtime = gametime;
}
}

View file

@ -43,7 +43,6 @@ typedef struct netnode_s
{
boolean ingame; // set false as nodes leave game
tic_t freezetimeout; // Until when can this node freeze the server before getting a timeout?
tic_t lastinput; // the last tic the player has made any input
SINT8 player;
SINT8 player2; // say the numplayer for this node if any (splitscreen)