Merge branch 'fix-node-player-mixups' into 'master'

Fix node numbers being used in place of player numbers

See merge request STJr/SRB2!681
This commit is contained in:
LJ Sonic 2020-01-12 15:40:25 -05:00
commit 34f73ec083
2 changed files with 12 additions and 12 deletions

View file

@ -1343,11 +1343,11 @@ static void SV_SendPlayerInfo(INT32 node)
{ {
if (!playeringame[i]) if (!playeringame[i])
{ {
netbuffer->u.playerinfo[i].node = 255; // This slot is empty. netbuffer->u.playerinfo[i].num = 255; // This slot is empty.
continue; continue;
} }
netbuffer->u.playerinfo[i].node = i; netbuffer->u.playerinfo[i].num = i;
strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1); strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1);
netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0'; netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0';
@ -4113,7 +4113,7 @@ static void HandlePacketFromPlayer(SINT8 node)
if (server) if (server)
{ {
UINT8 buf[2]; UINT8 buf[2];
buf[0] = (UINT8)node; buf[0] = (UINT8)netconsole;
buf[1] = KICK_MSG_CON_FAIL; buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2); SendNetXCmd(XD_KICK, &buf, 2);
} }
@ -4138,7 +4138,7 @@ static void HandlePacketFromPlayer(SINT8 node)
if (server) if (server)
{ {
UINT8 buf[2]; UINT8 buf[2];
buf[0] = (UINT8)node; buf[0] = (UINT8)netconsole;
buf[1] = KICK_MSG_CON_FAIL; buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2); SendNetXCmd(XD_KICK, &buf, 2);
} }
@ -4204,8 +4204,8 @@ static void HandlePacketFromPlayer(SINT8 node)
if (server) if (server)
{ {
char buf[2]; UINT8 buf[2];
buf[0] = (char)node; buf[0] = (UINT8)netconsole;
buf[1] = KICK_MSG_CON_FAIL; buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2); SendNetXCmd(XD_KICK, &buf, 2);
} }
@ -4223,8 +4223,8 @@ static void HandlePacketFromPlayer(SINT8 node)
if (server) if (server)
{ {
char buf[2]; UINT8 buf[2];
buf[0] = (char)node; buf[0] = (UINT8)netconsole;
buf[1] = KICK_MSG_CON_FAIL; buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2); SendNetXCmd(XD_KICK, &buf, 2);
} }
@ -4255,7 +4255,7 @@ static void HandlePacketFromPlayer(SINT8 node)
if (server) if (server)
{ {
UINT8 buf[2]; UINT8 buf[2];
buf[0] = (UINT8)node; buf[0] = (UINT8)netconsole;
buf[1] = KICK_MSG_CON_FAIL; buf[1] = KICK_MSG_CON_FAIL;
SendNetXCmd(XD_KICK, &buf, 2); SendNetXCmd(XD_KICK, &buf, 2);
} }
@ -4806,11 +4806,11 @@ static inline void PingUpdate(void)
if (pingtimeout[i] > cv_pingtimeout.value) if (pingtimeout[i] > cv_pingtimeout.value)
// ok your net has been bad for too long, you deserve to die. // ok your net has been bad for too long, you deserve to die.
{ {
char buf[2]; UINT8 buf[2];
pingtimeout[i] = 0; pingtimeout[i] = 0;
buf[0] = (char)i; buf[0] = (UINT8)i;
buf[1] = KICK_MSG_PING_HIGH; buf[1] = KICK_MSG_PING_HIGH;
SendNetXCmd(XD_KICK, &buf, 2); SendNetXCmd(XD_KICK, &buf, 2);
} }

View file

@ -375,7 +375,7 @@ typedef struct
// Shorter player information for external use. // Shorter player information for external use.
typedef struct typedef struct
{ {
UINT8 node; UINT8 num;
char name[MAXPLAYERNAME+1]; char name[MAXPLAYERNAME+1];
UINT8 address[4]; // sending another string would run us up against MAXPACKETLENGTH UINT8 address[4]; // sending another string would run us up against MAXPACKETLENGTH
UINT8 team; UINT8 team;