Improved Disconnect-handling between levels; Improved Kick-handling; Do not say that IPv4 and IPv6 builds are not compatible in scons -h anymore

This commit is contained in:
zicodxx 2009-11-24 15:20:09 +00:00
parent 34019d6414
commit 1ec38c1503
4 changed files with 49 additions and 37 deletions

View file

@ -4,6 +4,7 @@ D2X-Rebirth Changelog
--------
include/args.h, INSTALL.txt, main/net_udp.c, main/net_udp.h, main/fireball.c, main/multi.c, main/multibot.c, main/multi.h, main/inferno.c, main/menu.c, main/object.c, main/kmatrix.c, main/kmatrix.h, main/newdemo.c, main/config.c, main/net_ipx.c, main/config.h, main/net_ipx.h, main/gamerend.c, main/gameseq.c, main/endlevel.c, main/vers_id.h, main/game.c, main/gauges.c, misc/args.c, SConstruct, d2x.ini, README.txt, arch/linux/ipx.c, arch/linux/ipx_kali.c, arch/win32/ipx.c: Abstracting networking protocols - Step 4: Implemented new UDP layer with Client/Server communication, Packet Loss Prevention and strict Version checking. Netgames list will follow later.
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
20091117
--------

View file

@ -485,7 +485,7 @@ Help(PROGRAM_NAME + ', SConstruct file help:' +
'profiler=1' do profiler build
'editor=1' build editor !EXPERIMENTAL!
'arm=1' compile for ARM architecture
'ipv6=1' enables IPv6 copability (not compatible to non-IPv6 build)
'ipv6=1' enables IPv6 copability
Default values:
""" + ' sharepath = ' + DATA_DIR + """

View file

@ -2335,39 +2335,37 @@ void net_ipx_process_dump(IPX_sequence_packet *their)
{
// Our request for join was denied. Tell the user why.
char temp[40];
int i;
if (their->player.connected!=CONNECT_KMATRIX_WAITING)
{
nm_messagebox(NULL, 1, TXT_OK, NET_DUMP_STRINGS(their->player.connected));
Network_status = NETSTAT_MENU;
}
else
if (their->player.connected==DUMP_KICKED)
{
for (i=0;i<N_players;i++)
{
if (!stricmp (their->player.callsign,Players[i].callsign))
{
if (i!=multi_who_is_master())
if (i==multi_who_is_master())
{
HUD_init_message ("%s attempted to kick you out.",their->player.callsign);
if (Network_status==NETSTAT_PLAYING)
multi_leave_game();
Function_mode = FMODE_MENU;
nm_messagebox(NULL, 1, TXT_OK, "%s has kicked you out!",their->player.callsign);
Function_mode = FMODE_GAME;
multi_quit_game = 1;
multi_leave_menu = 1;
multi_reset_stuff();
Function_mode = FMODE_MENU;
}
else
{
sprintf (temp,"%s has kicked you out!",their->player.callsign);
nm_messagebox(NULL, 1, TXT_OK, &temp);
if (Network_status==NETSTAT_PLAYING)
{
multi_leave_game();
}
else
{
Network_status = NETSTAT_MENU;
}
HUD_init_message ("%s attempted to kick you out.",their->player.callsign);
}
}
}
}
else
{
nm_messagebox(NULL, 1, TXT_OK, NET_DUMP_STRINGS(their->player.connected));
Network_status = NETSTAT_MENU;
}
}
void net_ipx_process_request(IPX_sequence_packet *their)

View file

@ -340,7 +340,6 @@ void net_udp_game_connect(struct _sockaddr HostAddr)
{
fix start_time = 0, time = 0, last_time = 0;
net_udp_init();
N_players = 0;
change_playernum_to(1);
start_time = timer_get_fixed_seconds();
@ -423,13 +422,15 @@ void net_udp_manual_join_game()
{
struct _sockaddr HostAddr;
newmenu_item m[6];
int choice = 0, nitems = 0, j = 0;
int choice = 0, nitems = 0;
int old_game_mode;
char addrbuf[128]="";
char portbuf[6]="";
setjmp(LeaveGame);
net_udp_init();
memset(&addrbuf,'\0', sizeof(char)*128);
snprintf(addrbuf, sizeof(char)*(strlen(GameArg.MplUdpHostAddr)+1), "%s", GameArg.MplUdpHostAddr);
@ -534,6 +535,11 @@ void net_udp_init()
int t;
int save_pnum = Player_num;
if( UDP_Socket[0] != -1 )
udp_close_socket(0);
if( UDP_Socket[1] != -1 )
udp_close_socket(1);
game_disable_cheats();
Final_boss_is_dead=0;
@ -2023,28 +2029,25 @@ void net_udp_process_game_info(ubyte *data, int data_len, struct _sockaddr game_
void net_udp_process_dump(ubyte *data, int len, struct _sockaddr sender_addr)
{
// Our request for join was denied. Tell the user why.
char temp[40];
if (memcmp((struct _sockaddr *)&sender_addr,(struct _sockaddr *)&Netgame.players[0].protocol.udp.addr,sizeof(struct _sockaddr)))
return;
if (data[1]!=DUMP_KICKED)
if (data[1]==DUMP_KICKED)
{
nm_messagebox(NULL, 1, TXT_OK, NET_DUMP_STRINGS(data[1]));
Network_status = NETSTAT_MENU;
if (Network_status==NETSTAT_PLAYING)
multi_leave_game();
Function_mode = FMODE_MENU;
nm_messagebox(NULL, 1, TXT_OK, "%s has kicked you out!",Players[0].callsign);
Function_mode = FMODE_GAME;
multi_quit_game = 1;
multi_leave_menu = 1;
multi_reset_stuff();
Function_mode = FMODE_MENU;
}
else
{
sprintf (temp,"%s has kicked you out!",Netgame.players[0].callsign);
nm_messagebox(NULL, 1, TXT_OK, &temp);
if (Network_status==NETSTAT_PLAYING)
{
multi_leave_game();
}
else
{
Network_status = NETSTAT_MENU;
}
nm_messagebox(NULL, 1, TXT_OK, NET_DUMP_STRINGS(data[1]));
Network_status = NETSTAT_MENU;
}
}
@ -2409,6 +2412,11 @@ void net_udp_sync_poll( int nitems, newmenu_item * menus, int * key, int citem )
net_udp_listen();
// Leave if Host disconnects
if (Netgame.players[0].connected == CONNECT_DISCONNECTED)
*key = -2;
if (Network_status != NETSTAT_WAITING) // Status changed to playing, exit the menu
*key = -2;
@ -3574,6 +3582,11 @@ void net_udp_leave_game()
write_player_file();
net_udp_flush();
if( UDP_Socket[0] != -1 )
udp_close_socket(0);
if( UDP_Socket[1] != -1 )
udp_close_socket(1);
}
void net_udp_flush()