Again making the joining safer
This commit is contained in:
parent
53c19912fa
commit
0d4a53766e
|
@ -6,6 +6,7 @@ include/args.h, INSTALL.txt, main/net_udp.c, main/net_udp.h, main/fireball.c, ma
|
||||||
main/net_udp.c: Remove the IP check when processing game info or version deny as the IP might be translated (IPv6 especially)
|
main/net_udp.c: Remove the IP check when processing game info or version deny as the IP might be translated (IPv6 especially)
|
||||||
main/net_udp.c, main/net_ipx.c, SConstruct: Improved Disconnect-handling between levels; Improved Kick-handling; Do not say that IPv4 and IPv6 builds are not compatible in scons -h anymore
|
main/net_udp.c, main/net_ipx.c, SConstruct: Improved Disconnect-handling between levels; Improved Kick-handling; Do not say that IPv4 and IPv6 builds are not compatible in scons -h anymore
|
||||||
include/timer.h, main/net_udp.c, main/newmenu.c, main/multibot.c, main/menu.c, main/titles.c, main/kmatrix.c, main/net_ipx.c, main/digiobj.c, arch/sdl/timer.c: Removed timer_get_approx_seconds() and replaced with timer_get_fixed seconds since it was too inaccurate and created significant offset
|
include/timer.h, main/net_udp.c, main/newmenu.c, main/multibot.c, main/menu.c, main/titles.c, main/kmatrix.c, main/net_ipx.c, main/digiobj.c, arch/sdl/timer.c: Removed timer_get_approx_seconds() and replaced with timer_get_fixed seconds since it was too inaccurate and created significant offset
|
||||||
|
main/net_udp.c: Again making the joining safer
|
||||||
|
|
||||||
20091117
|
20091117
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -855,7 +855,7 @@ void net_udp_welcome_player(UDP_sequence_packet *their)
|
||||||
|
|
||||||
for (i = 0; i < N_players; i++)
|
for (i = 0; i < N_players; i++)
|
||||||
{
|
{
|
||||||
if (!memcmp((struct _sockaddr *)&their->player.protocol.udp.addr, (struct _sockaddr *)&Netgame.players[i].protocol.udp.addr, sizeof(struct _sockaddr)))
|
if ((!strcasecmp(Players[i].callsign, their->player.callsign )) && !memcmp((struct _sockaddr *)&their->player.protocol.udp.addr, (struct _sockaddr *)&Netgame.players[i].protocol.udp.addr, sizeof(struct _sockaddr)))
|
||||||
{
|
{
|
||||||
player_num = i;
|
player_num = i;
|
||||||
break;
|
break;
|
||||||
|
@ -956,6 +956,7 @@ void net_udp_welcome_player(UDP_sequence_packet *their)
|
||||||
UDP_sync_player.player.connected = player_num;
|
UDP_sync_player.player.connected = player_num;
|
||||||
Network_send_objects = 1;
|
Network_send_objects = 1;
|
||||||
Network_send_objnum = -1;
|
Network_send_objnum = -1;
|
||||||
|
Netgame.players[player_num].LastPacketTime = timer_get_fixed_seconds();
|
||||||
|
|
||||||
net_udp_send_objects();
|
net_udp_send_objects();
|
||||||
}
|
}
|
||||||
|
@ -1461,11 +1462,13 @@ char * net_udp_get_player_name( int objnum )
|
||||||
void net_udp_add_player(UDP_sequence_packet *p)
|
void net_udp_add_player(UDP_sequence_packet *p)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
fix time = timer_get_fixed_seconds();
|
||||||
|
|
||||||
for (i=0; i<N_players; i++ )
|
for (i=0; i<N_players; i++ )
|
||||||
{
|
{
|
||||||
if ( !memcmp( (struct _sockaddr *)&Netgame.players[i].protocol.udp.addr, (struct _sockaddr *)&p->player.protocol.udp.addr, sizeof(struct _sockaddr)))
|
if ( !memcmp( (struct _sockaddr *)&Netgame.players[i].protocol.udp.addr, (struct _sockaddr *)&p->player.protocol.udp.addr, sizeof(struct _sockaddr)))
|
||||||
{
|
{
|
||||||
|
Netgame.players[i].LastPacketTime = time;
|
||||||
return; // already got them
|
return; // already got them
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1485,7 +1488,7 @@ void net_udp_add_player(UDP_sequence_packet *p)
|
||||||
net_udp_check_for_old_version (N_players);
|
net_udp_check_for_old_version (N_players);
|
||||||
Players[N_players].KillGoalCount=0;
|
Players[N_players].KillGoalCount=0;
|
||||||
Players[N_players].connected = CONNECT_PLAYING;
|
Players[N_players].connected = CONNECT_PLAYING;
|
||||||
Netgame.players[N_players].LastPacketTime = timer_get_fixed_seconds();
|
Netgame.players[N_players].LastPacketTime = time;
|
||||||
N_players++;
|
N_players++;
|
||||||
Netgame.numplayers = N_players;
|
Netgame.numplayers = N_players;
|
||||||
|
|
||||||
|
@ -2057,9 +2060,10 @@ void net_udp_process_request(UDP_sequence_packet *their)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < N_players; i++)
|
for (i = 0; i < N_players; i++)
|
||||||
if (!memcmp((struct _sockaddr *)&their->player.protocol.udp.addr, (struct _sockaddr *)&Netgame.players[i].protocol.udp.addr, sizeof(struct _sockaddr)))
|
if (!memcmp((struct _sockaddr *)&their->player.protocol.udp.addr, (struct _sockaddr *)&Netgame.players[i].protocol.udp.addr, sizeof(struct _sockaddr)) && (!strcasecmp(their->player.callsign, Netgame.players[i].callsign)))
|
||||||
{
|
{
|
||||||
Players[i].connected = CONNECT_PLAYING;
|
Players[i].connected = CONNECT_PLAYING;
|
||||||
|
Netgame.players[i].LastPacketTime = timer_get_fixed_seconds();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3039,7 +3043,7 @@ void net_udp_send_sync(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Randomize their starting locations...
|
// Randomize their starting locations...
|
||||||
|
d_srand( timer_get_fixed_seconds() );
|
||||||
for (i=0; i<NumNetPlayerPositions; i++ )
|
for (i=0; i<NumNetPlayerPositions; i++ )
|
||||||
{
|
{
|
||||||
if (Players[i].connected)
|
if (Players[i].connected)
|
||||||
|
@ -3666,9 +3670,8 @@ void net_udp_timeout_check(fix time)
|
||||||
if ((Netgame.players[i].LastPacketTime == 0) || (Netgame.players[i].LastPacketTime > time))
|
if ((Netgame.players[i].LastPacketTime == 0) || (Netgame.players[i].LastPacketTime > time))
|
||||||
{
|
{
|
||||||
Netgame.players[i].LastPacketTime = time;
|
Netgame.players[i].LastPacketTime = time;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if ((time - Netgame.players[i].LastPacketTime) > UDP_TIMEOUT)
|
else if ((time - Netgame.players[i].LastPacketTime) > UDP_TIMEOUT)
|
||||||
{
|
{
|
||||||
net_udp_timeout_player(i);
|
net_udp_timeout_player(i);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue