Instead of calling object/extras sending every frame, use a delay of 100ms between packet send to not overload the network stack

This commit is contained in:
zicodxx 2011-01-19 00:07:06 +01:00
parent 61a5524e4e
commit 0177a6f2ae
3 changed files with 20 additions and 3 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
--------
main/gamecntl.c, main/gameseq.c: Allowing loading a savestate while being in death sequence and resetting Dead_player_camera correctly in init_player_stats_level() so forther death sequences won't screw up
main/net_udp.c: In net_udp_send_objects() player_num byte was not considered for mode 1 resulting on incorrect object count for this mode
main/net_ipx.c, main/net_udp.c: Instead of calling object/extras sending every frame, use a delay of 100ms between packet send to not overload the network stack
20110117
--------

View file

@ -1308,6 +1308,11 @@ void net_ipx_send_objects(void)
int obj_count_frame = 0;
int player_num = IPX_sync_player.player.connected;
static fix64 last_send_time = 0;
if (last_send_time + (F1_0/10) > timer_query())
return;
last_send_time = timer_query();
// Send clear objects array trigger and send player num

View file

@ -1352,6 +1352,11 @@ void net_udp_send_objects(void)
sbyte owner, player_num = UDP_sync_player.player.connected;
static int obj_count = 0;
int loc = 0, i = 0, remote_objnum = 0, obj_count_frame = 0;
static fix64 last_send_time = 0;
if (last_send_time + (F1_0/10) > timer_query())
return;
last_send_time = timer_query();
// Send clear objects array trigger and send player num
@ -1451,7 +1456,7 @@ void net_udp_send_objects(void)
Network_send_objects = 0;
obj_count = 0;
Network_sending_extras=25; // start to send extras
Network_sending_extras=2; // start to send extras
VerifyPlayerJoined = Player_joining_extras = player_num;
return;
@ -4555,11 +4560,17 @@ int net_udp_get_new_player_num (UDP_sequence_packet *their)
void net_udp_send_extras ()
{
static fix64 last_send_time = 0;
if (last_send_time + (F1_0/10) > timer_query())
return;
last_send_time = timer_query();
Assert (Player_joining_extras>-1);
if (Network_sending_extras==25 && (Netgame.PlayTimeAllowed || Netgame.KillGoal))
if (Network_sending_extras==2 && (Netgame.PlayTimeAllowed || Netgame.KillGoal))
multi_send_kill_goal_counts();
if (Network_sending_extras==10)
if (Network_sending_extras==1)
multi_send_powcap_update();
Network_sending_extras--;