Player Connection Test bug

origin
stpohle 21 years ago
parent 9c74e9393c
commit 1073a3d85a

@ -1,4 +1,4 @@
/* $Id: packets.h,v 1.29 2004/11/30 14:30:36 stpohle Exp $ /* $Id: packets.h,v 1.30 2004/12/24 03:13:49 stpohle Exp $
* network packets.. */ * network packets.. */
#ifndef _PACKETS_H_ #ifndef _PACKETS_H_
@ -14,9 +14,9 @@
* are between all clients so they will be forwarded. */ * are between all clients so they will be forwarded. */
enum _network_data { enum _network_data {
PKG_error = 0, PKG_error = 0,
PKG_joingame, PKG_joingame, // every packet below here will checked
PKG_contest, // every packet below here will checked
// if it comes from a orginal player // if it comes from a orginal player
PKG_contest,
PKG_playerid, PKG_playerid,
PKG_servermode, PKG_servermode,
PKG_pingreq, PKG_pingreq,

@ -180,12 +180,13 @@ do_joingame (struct pkg_joingame *p_jg, _net_addr * addr)
addr->pl_nr = i; addr->pl_nr = i;
/* Send all connected players the new PlayerID, except to the new player */ /* Send all connected players the new PlayerID, except to the new player
for (i = 0; i < MAX_PLAYERS; i++) for (i = 0; i < MAX_PLAYERS; i++)
if (NET_CANSEND(i) && addr->pl_nr != i) if (NET_CANSEND(i) && addr->pl_nr != i)
send_playerid (&players[i].net.addr, pl->name, pl->net.addr.host, send_playerid (&players[i].net.addr, pl->name, pl->net.addr.host,
pl->net.addr.port, pl->net.addr.pl_nr, pl->gfx_nr, pl->net.addr.port, pl->net.addr.pl_nr, pl->gfx_nr,
pl->team_nr, pl->net.flags); pl->team_nr, pl->net.flags);
*/
} }
else if (GS_WAITRUNNING) { else if (GS_WAITRUNNING) {
@ -304,6 +305,13 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr)
* check if we have to send the whole playerlist to a client * check if we have to send the whole playerlist to a client
*/ */
if (GT_MP_PTPM && p_id->pl_nr == -1) { if (GT_MP_PTPM && p_id->pl_nr == -1) {
/* Send all connected players the new PlayerID, except to the new player */
for (i = 0; i < MAX_PLAYERS; i++)
if (NET_CANSEND(i) && addr->pl_nr != i)
send_playerid (&players[i].net.addr, pl->name, pl->net.addr.host,
pl->net.addr.port, pl->net.addr.pl_nr, pl->gfx_nr,
pl->team_nr, pl->net.flags);
for (i = 0; i < MAX_PLAYERS; i++) for (i = 0; i < MAX_PLAYERS; i++)
send_playerid (addr, players[i].name, players[i].net.addr.host, players[i].net.addr.port, i, players[i].gfx_nr, players[i].team_nr, players[i].net.flags); send_playerid (addr, players[i].name, players[i].net.addr.host, players[i].net.addr.port, i, players[i].gfx_nr, players[i].team_nr, players[i].net.flags);
} }
@ -336,7 +344,7 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr)
/* Check if we have to make a network test.. only client to client /* Check if we have to make a network test.. only client to client
* we won't check 2 players too because i't won't be possible to send * we won't check 2 players too because i't won't be possible to send
* something to them. */ * something to them. Start the timer for the connection test. */
if (GT_MP_PTPS && !(PS_IS_netplayer (pl->state)) && (PS_IS_netplayer (p_id->state)) if (GT_MP_PTPS && !(PS_IS_netplayer (pl->state)) && (PS_IS_netplayer (p_id->state))
&& p_id->pl_nr != bman.p_servnr && p_id->pl_nr != bman.p_nr && p_id->pl_nr != bman.p_servnr && p_id->pl_nr != bman.p_nr
&& !(pl->net.flags & NETF_local2) && p_id->pl_nr != bman.p2_nr) { && !(pl->net.flags & NETF_local2) && p_id->pl_nr != bman.p2_nr) {
@ -1664,9 +1672,9 @@ do_pkg (struct pkg *packet, _net_addr * addr)
/* get the addr and set the ping timeout value /* get the addr and set the ping timeout value
* check if the packet is from a player in the game and not from someone else * check if the packet is from a player in the game and not from someone else
* this exception is only for PKG_joingame, PKG_error and PKG_contest */ * this exception is only for PKG_joingame, PKG_error */
addr->pl_nr = get_player_nr (addr->host, addr->port); addr->pl_nr = get_player_nr (addr->host, addr->port);
if ((addr->pl_nr < 0 || addr->pl_nr >= MAX_PLAYERS) && packet->h.typ > PKG_contest && PS_IS_netplayer (players[addr->pl_nr].state)) { if ((addr->pl_nr < 0 || addr->pl_nr >= MAX_PLAYERS) && packet->h.typ > PKG_joingame && PS_IS_netplayer (players[addr->pl_nr].state)) {
d_printf ("do_pkg: error addr->pl_nr out of range\n"); d_printf ("do_pkg: error addr->pl_nr out of range\n");
return 0; return 0;
} }

Loading…
Cancel
Save