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:
@@ -131,8 +131,10 @@ namespace Barotrauma.Networking
|
|||||||
UInt16 thisEventID = (UInt16)(firstEventID + (UInt16)i);
|
UInt16 thisEventID = (UInt16)(firstEventID + (UInt16)i);
|
||||||
UInt16 entityID = msg.ReadUInt16();
|
UInt16 entityID = msg.ReadUInt16();
|
||||||
|
|
||||||
if (entityID == 0)
|
if (entityID == 0 && thisEventID == (UInt16)(lastReceivedID + 1))
|
||||||
{
|
{
|
||||||
|
DebugConsole.NewMessage("received empty event " + thisEventID, Microsoft.Xna.Framework.Color.Orange);
|
||||||
|
|
||||||
msg.ReadPadBits();
|
msg.ReadPadBits();
|
||||||
lastReceivedID++;
|
lastReceivedID++;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -45,9 +45,11 @@ namespace Barotrauma.Networking
|
|||||||
tempBuffer.LengthBytes < 128,
|
tempBuffer.LengthBytes < 128,
|
||||||
"Maximum EntityEvent size exceeded when serializing \""+e.Entity+"\"!");
|
"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)
|
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.Write((UInt16)0);
|
||||||
msg.WritePadBits();
|
msg.WritePadBits();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user