From 57c33695e6a6392cc9f9285523d39e2e4319efc4 Mon Sep 17 00:00:00 2001 From: zico Date: Sat, 5 Mar 2016 12:05:43 +0100 Subject: [PATCH] Do not read pdata packets while the level isn't loaded and try not to send packets to players in these states. --- similar/main/net_udp.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/similar/main/net_udp.cpp b/similar/main/net_udp.cpp index 9e46f7e03..bdd3694c4 100644 --- a/similar/main/net_udp.cpp +++ b/similar/main/net_udp.cpp @@ -5324,7 +5324,7 @@ void net_udp_process_pdata(const uint8_t *data, uint_fast32_t data_len, const _s { for (int i = 1; i < MAX_PLAYERS; i++) { - if (i != pd.Player_num && Players[i].connected != CONNECT_DISCONNECTED) // not to sender or disconnected players - right. + if (i != pd.Player_num && (Players[i].connected != CONNECT_DISCONNECTED || Players[i].connected != CONNECT_WAITING)) // not to sender or disconnected/waiting players - right. dxx_sendto(Netgame.players[i].protocol.udp.addr, UDP_Socket[0], data, data_len, 0); } } @@ -5390,8 +5390,9 @@ void net_udp_read_pdata_packet(UDP_frame_info *pd) const auto TheirObj = vobjptridx(TheirObjnum); Netgame.players[TheirPlayernum].LastPacketTime = timer_query(); + if (Players[Player_num].connected == CONNECT_DISCONNECTED || Players[Player_num].connected == CONNECT_WAITING) // do not read the packet unless the level is loaded. + return; //------------ Read the player's ship's object info ---------------------- - extract_quaternionpos(TheirObj, &pd->qpp, 0); if (TheirObj->movement_type == MT_PHYSICS) set_thrust_from_velocity(TheirObj);