Resetting entity event IDs (lastSentToAll & client-specific IDs) when a round ends
This commit is contained in:
@@ -640,6 +640,10 @@ namespace Barotrauma.Networking
|
|||||||
UInt32 lastEntitySpawnID = Entity.Spawner.NetStateID;
|
UInt32 lastEntitySpawnID = Entity.Spawner.NetStateID;
|
||||||
UInt32 lastEntityEventID = entityEventManager.Events.Count == 0 ? 0 : entityEventManager.Events.Last().ID;
|
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)
|
if (c.NeedsMidRoundSync)
|
||||||
{
|
{
|
||||||
//received all the old events -> client in sync, we can switch to normal behavior
|
//received all the old events -> client in sync, we can switch to normal behavior
|
||||||
@@ -1049,11 +1053,14 @@ namespace Barotrauma.Networking
|
|||||||
List<CharacterInfo> characterInfos = new List<CharacterInfo>();
|
List<CharacterInfo> characterInfos = new List<CharacterInfo>();
|
||||||
foreach (Client client in teamClients)
|
foreach (Client client in teamClients)
|
||||||
{
|
{
|
||||||
|
client.NeedsMidRoundSync = false;
|
||||||
|
|
||||||
client.lastRecvEntitySpawnID = 0;
|
client.lastRecvEntitySpawnID = 0;
|
||||||
|
|
||||||
client.entityEventLastSent.Clear();
|
client.entityEventLastSent.Clear();
|
||||||
client.lastSentEntityEventID = 0;
|
client.lastSentEntityEventID = 0;
|
||||||
client.lastRecvEntityEventID = 0;
|
client.lastRecvEntityEventID = 0;
|
||||||
|
client.UnreceivedEntityEventCount = 0;
|
||||||
|
|
||||||
if (client.characterInfo == null)
|
if (client.characterInfo == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -314,9 +314,16 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
bufferedEvents.Clear();
|
bufferedEvents.Clear();
|
||||||
|
|
||||||
|
lastSentToAll = 0;
|
||||||
|
|
||||||
uniqueEvents.Clear();
|
uniqueEvents.Clear();
|
||||||
|
|
||||||
server.ConnectedClients.ForEach(c => c.entityEventLastSent.Clear());
|
foreach (Client c in server.ConnectedClients)
|
||||||
|
{
|
||||||
|
c.entityEventLastSent.Clear();
|
||||||
|
c.lastRecvEntityEventID = 0;
|
||||||
|
c.lastSentEntityEventID = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user