diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index aba979f74..edea51ea0 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -640,6 +640,10 @@ namespace Barotrauma.Networking UInt32 lastEntitySpawnID = Entity.Spawner.NetStateID; UInt32 lastEntityEventID = entityEventManager.Events.Count == 0 ? 0 : entityEventManager.Events.Last().ID; + Debug.Assert( + c.lastRecvEntityEventID.GetType() == typeof(UInt32), + "Event ID type changed, you may need to reimplement MidRound syncing logic to handle ID wraparound"); + if (c.NeedsMidRoundSync) { //received all the old events -> client in sync, we can switch to normal behavior @@ -1049,11 +1053,14 @@ namespace Barotrauma.Networking List characterInfos = new List(); foreach (Client client in teamClients) { + client.NeedsMidRoundSync = false; + client.lastRecvEntitySpawnID = 0; client.entityEventLastSent.Clear(); client.lastSentEntityEventID = 0; client.lastRecvEntityEventID = 0; + client.UnreceivedEntityEventCount = 0; if (client.characterInfo == null) { diff --git a/Subsurface/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs b/Subsurface/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs index c370dc2f1..f4a872aae 100644 --- a/Subsurface/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs +++ b/Subsurface/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs @@ -314,9 +314,16 @@ namespace Barotrauma.Networking bufferedEvents.Clear(); + lastSentToAll = 0; + uniqueEvents.Clear(); - server.ConnectedClients.ForEach(c => c.entityEventLastSent.Clear()); + foreach (Client c in server.ConnectedClients) + { + c.entityEventLastSent.Clear(); + c.lastRecvEntityEventID = 0; + c.lastSentEntityEventID = 0; + } } } }