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 2c2dc3fc13
commit cf3f852095
4 changed files with 61 additions and 31 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
--------
include/args.h, main/net_udp.c, main/net_udp.h, main/gameseg.c, main/fireball.c, main/multi.c, main/multi.h, main/inferno.c, main/menu.c, main/titles.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/gameseq.c, main/gamerend.c, main/vers_id.h, main/gauges.c, main/gamecntl.c, INSTALL.txt, misc/args.c, SConstruct, d1x.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
20091122
--------

View file

@ -473,7 +473,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

@ -1849,21 +1849,38 @@ void net_ipx_process_dump(IPX_sequence_packet *their)
{
// Our request for join was denied. Tell the user why.
// Begin addition by GF
if (Network_status == NETSTAT_PLAYING)
int i;
if (their->player.connected==DUMP_KICKED)
{
Function_mode = FMODE_MENU;
nm_messagebox(NULL, 1, TXT_OK, "You have been kicked from the game!");
multi_quit_game = 1;
multi_leave_menu = 1;
multi_reset_stuff();
return;
for (i=0;i<N_players;i++)
{
if (!stricmp (their->player.callsign,Players[i].callsign))
{
if (i==multi_who_is_master())
{
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
{
HUD_init_message ("%s attempted to kick you out.",their->player.callsign);
}
}
}
}
// End addition by GF
nm_messagebox(NULL, 1, TXT_OK, NET_DUMP_STRINGS(their->player.connected));
Network_status = NETSTAT_MENU;
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

@ -316,7 +316,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();
@ -399,13 +398,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);
@ -511,6 +512,11 @@ void net_udp_init()
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();
memset(&Netgame, 0, sizeof(netgame_info));
@ -1858,28 +1864,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;
}
}
@ -2236,6 +2239,10 @@ 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;
@ -3270,6 +3277,11 @@ void net_udp_leave_game()
change_playernum_to(0);
Game_mode = GM_GAME_OVER;
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()