Centralized UDP Broadcast function for IPv4 and IPv6 calls - patch by Kp
This commit is contained in:
parent
f3cad7ce27
commit
b68e3f430c
|
@ -1,5 +1,9 @@
|
||||||
D2X-Rebirth Changelog
|
D2X-Rebirth Changelog
|
||||||
|
|
||||||
|
20130103
|
||||||
|
--------
|
||||||
|
main/net_udp.c: Centralized UDP Broadcast function for IPv4 and IPv6 calls - patch by Kp
|
||||||
|
|
||||||
20121102
|
20121102
|
||||||
--------
|
--------
|
||||||
arch/include/key.h, arch/sdl/key.c, main/kconfig.c: Made key_properties readable in other files; Eliminated key_text variable; Marked unicode_frame_buffer as extern in header - patches by Kp
|
arch/include/key.h, arch/sdl/key.c, main/kconfig.c: Made key_properties readable in other files; Eliminated key_text variable; Marked unicode_frame_buffer as extern in header - patches by Kp
|
||||||
|
|
|
@ -101,6 +101,8 @@ extern void multi_send_wall_status_specific (int pnum,int wallnum,ubyte type,uby
|
||||||
extern void multi_send_light_specific (int pnum,int segnum,ubyte val);
|
extern void multi_send_light_specific (int pnum,int segnum,ubyte val);
|
||||||
extern void multi_send_trigger_specific (char pnum,char trig);
|
extern void multi_send_trigger_specific (char pnum,char trig);
|
||||||
|
|
||||||
|
static void net_udp_broadcast_game_info(ubyte info_upid);
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
int UDP_num_sendto = 0, UDP_len_sendto = 0, UDP_num_recvfrom = 0, UDP_len_recvfrom = 0;
|
int UDP_num_sendto = 0, UDP_len_sendto = 0, UDP_num_recvfrom = 0, UDP_len_recvfrom = 0;
|
||||||
UDP_mdata_info UDP_MData;
|
UDP_mdata_info UDP_MData;
|
||||||
|
@ -2290,6 +2292,14 @@ void net_udp_send_game_info(struct _sockaddr sender_addr, ubyte info_upid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void net_udp_broadcast_game_info(ubyte info_upid)
|
||||||
|
{
|
||||||
|
net_udp_send_game_info(GBcast, info_upid);
|
||||||
|
#ifdef IPv6
|
||||||
|
net_udp_send_game_info(GMcast_v6, info_upid);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Send game info to all players in this game. Also send lite_info for people watching the netlist */
|
/* Send game info to all players in this game. Also send lite_info for people watching the netlist */
|
||||||
void net_udp_send_netgame_update()
|
void net_udp_send_netgame_update()
|
||||||
{
|
{
|
||||||
|
@ -2301,10 +2311,7 @@ void net_udp_send_netgame_update()
|
||||||
continue;
|
continue;
|
||||||
net_udp_send_game_info(Netgame.players[i].protocol.udp.addr, UPID_GAME_INFO);
|
net_udp_send_game_info(Netgame.players[i].protocol.udp.addr, UPID_GAME_INFO);
|
||||||
}
|
}
|
||||||
net_udp_send_game_info(GBcast, UPID_GAME_INFO_LITE);
|
net_udp_broadcast_game_info(UPID_GAME_INFO_LITE);
|
||||||
#ifdef IPv6
|
|
||||||
net_udp_send_game_info(GMcast_v6, UPID_GAME_INFO_LITE);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int net_udp_send_request(void)
|
int net_udp_send_request(void)
|
||||||
|
@ -3475,10 +3482,7 @@ int net_udp_send_sync(void)
|
||||||
net_udp_dump_player(Netgame.players[i].protocol.udp.addr, DUMP_ABORTED);
|
net_udp_dump_player(Netgame.players[i].protocol.udp.addr, DUMP_ABORTED);
|
||||||
net_udp_send_game_info(Netgame.players[i].protocol.udp.addr, UPID_GAME_INFO);
|
net_udp_send_game_info(Netgame.players[i].protocol.udp.addr, UPID_GAME_INFO);
|
||||||
}
|
}
|
||||||
net_udp_send_game_info(GBcast, UPID_GAME_INFO_LITE);
|
net_udp_broadcast_game_info(UPID_GAME_INFO_LITE);
|
||||||
#ifdef IPv6
|
|
||||||
net_udp_send_game_info(GMcast_v6, UPID_GAME_INFO_LITE);
|
|
||||||
#endif
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3656,10 +3660,7 @@ abort:
|
||||||
net_udp_dump_player(Netgame.players[i].protocol.udp.addr, DUMP_ABORTED);
|
net_udp_dump_player(Netgame.players[i].protocol.udp.addr, DUMP_ABORTED);
|
||||||
net_udp_send_game_info(Netgame.players[i].protocol.udp.addr, UPID_GAME_INFO);
|
net_udp_send_game_info(Netgame.players[i].protocol.udp.addr, UPID_GAME_INFO);
|
||||||
}
|
}
|
||||||
net_udp_send_game_info(GBcast, UPID_GAME_INFO_LITE);
|
net_udp_broadcast_game_info(UPID_GAME_INFO_LITE);
|
||||||
#ifdef IPv6
|
|
||||||
net_udp_send_game_info(GMcast_v6, UPID_GAME_INFO_LITE);
|
|
||||||
#endif
|
|
||||||
Netgame.numplayers = save_nplayers;
|
Netgame.numplayers = save_nplayers;
|
||||||
|
|
||||||
Network_status = NETSTAT_MENU;
|
Network_status = NETSTAT_MENU;
|
||||||
|
@ -3777,10 +3778,7 @@ int net_udp_start_game(void)
|
||||||
Game_mode = GM_GAME_OVER;
|
Game_mode = GM_GAME_OVER;
|
||||||
return 0; // see if we want to tweak the game we setup
|
return 0; // see if we want to tweak the game we setup
|
||||||
}
|
}
|
||||||
net_udp_send_game_info(GBcast, UPID_GAME_INFO_LITE); // game started. broadcast our current status to everyone who wants to know
|
net_udp_broadcast_game_info(UPID_GAME_INFO_LITE); // game started. broadcast our current status to everyone who wants to know
|
||||||
#ifdef IPv6
|
|
||||||
net_udp_send_game_info(GMcast_v6, UPID_GAME_INFO_LITE); // game started. broadcast our current status to everyone who wants to know
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 1; // don't keep params menu or mission listbox (may want to join a game next time)
|
return 1; // don't keep params menu or mission listbox (may want to join a game next time)
|
||||||
}
|
}
|
||||||
|
@ -4021,10 +4019,7 @@ void net_udp_leave_game()
|
||||||
continue;
|
continue;
|
||||||
net_udp_send_game_info(Netgame.players[i].protocol.udp.addr, UPID_GAME_INFO);
|
net_udp_send_game_info(Netgame.players[i].protocol.udp.addr, UPID_GAME_INFO);
|
||||||
}
|
}
|
||||||
net_udp_send_game_info(GBcast, UPID_GAME_INFO_LITE);
|
net_udp_broadcast_game_info(UPID_GAME_INFO_LITE);
|
||||||
#ifdef IPv6
|
|
||||||
net_udp_send_game_info(GMcast_v6, UPID_GAME_INFO_LITE);
|
|
||||||
#endif
|
|
||||||
N_players=nsave;
|
N_players=nsave;
|
||||||
#ifdef USE_TRACKER
|
#ifdef USE_TRACKER
|
||||||
if( Netgame.Tracker )
|
if( Netgame.Tracker )
|
||||||
|
@ -4185,10 +4180,7 @@ void net_udp_do_frame(int force, int listen)
|
||||||
if (multi_i_am_master() && time>=last_bcast_time+(F1_0*10))
|
if (multi_i_am_master() && time>=last_bcast_time+(F1_0*10))
|
||||||
{
|
{
|
||||||
last_bcast_time = time;
|
last_bcast_time = time;
|
||||||
net_udp_send_game_info(GBcast, UPID_GAME_INFO_LITE);
|
net_udp_broadcast_game_info(UPID_GAME_INFO_LITE);
|
||||||
#ifdef IPv6
|
|
||||||
net_udp_send_game_info(GMcast_v6, UPID_GAME_INFO_LITE);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_TRACKER
|
#ifdef USE_TRACKER
|
||||||
|
|
Loading…
Reference in a new issue