Fixed clients incrementing their lastReceivedID every time they receive an empty entity event (even if the event has already been received)

This commit is contained in:
Regalis
2017-05-02 22:15:18 +03:00
parent 6c770afd6a
commit 06db2fed86
2 changed files with 7 additions and 3 deletions

View File

@@ -45,9 +45,11 @@ namespace Barotrauma.Networking
tempBuffer.LengthBytes < 128,
"Maximum EntityEvent size exceeded when serializing \""+e.Entity+"\"!");
//the ID has been taken by another entity (the original entity has been removed) -> write an empty event
if (Entity.FindEntityByID(e.Entity.ID) != e.Entity)
{
//DebugConsole.ThrowError("Error in NetEntityEventManager.Write (FindEntityByID(e.Entity.ID) != e.Entity)");
//technically the clients don't have any use for these, but removing events and shifting the IDs of all
//consecutive ones is so error-prone that I think this is a safer option
msg.Write((UInt16)0);
msg.WritePadBits();
}