diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs index adbc146eb..c794bd446 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs @@ -986,6 +986,9 @@ namespace Barotrauma.Networking long prevBitPos = 0; long prevBytePos = 0; + long prevBitLength = 0; + long prevByteLength = 0; + ServerNetObject objHeader; while ((objHeader = (ServerNetObject)inc.ReadByte()) != ServerNetObject.END_OF_MESSAGE) { @@ -1023,8 +1026,9 @@ namespace Barotrauma.Networking List errorLines = new List { "Error while reading update from server (unknown object header \"" + objHeader + "\"!)", + "Message length: " + inc.LengthBits + " (" + inc.LengthBytes + " bytes)", prevObjHeader != null ? "Previous object type: " + prevObjHeader.ToString() : "Error occurred on the very first object!", - "Previous object was " + (inc.Position - prevBitPos) + " bits long (" + (inc.PositionInBytes - prevBytePos) + " bytes)" + "Previous object was " + (prevBitLength) + " bits long (" + (prevByteLength) + " bytes)" }; if (prevObjHeader == ServerNetObject.ENTITY_EVENT || prevObjHeader == ServerNetObject.ENTITY_EVENT_INITIAL) { @@ -1051,13 +1055,16 @@ namespace Barotrauma.Networking FileStream fl = File.Open("crashreport_object.bin", FileMode.Create); BinaryWriter sw = new BinaryWriter(fl); - sw.Write(inc.Data, (int)prevBytePos, (int)(inc.LengthBytes - prevBytePos)); + sw.Write(inc.Data, (int)(prevBytePos - prevByteLength), (int)(prevByteLength)); sw.Close(); fl.Close(); throw new Exception("Error while reading update from server: please send us \"crashreport_object.bin\"!"); } + prevBitLength = inc.Position - prevBitPos; + prevByteLength = inc.PositionInBytes - prevByteLength; + prevObjHeader = objHeader; prevBitPos = inc.Position; prevBytePos = inc.PositionInBytes; diff --git a/Barotrauma/BarotraumaClient/Source/Networking/NetEntityEvent/ClientEntityEventManager.cs b/Barotrauma/BarotraumaClient/Source/Networking/NetEntityEvent/ClientEntityEventManager.cs index cd4c92164..f8cec2fe5 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/NetEntityEvent/ClientEntityEventManager.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/NetEntityEvent/ClientEntityEventManager.cs @@ -140,7 +140,13 @@ namespace Barotrauma.Networking if (entityID == 0) { + if (GameSettings.VerboseLogging) + { + DebugConsole.NewMessage("received msg " + thisEventID + " (null entity)", + Microsoft.Xna.Framework.Color.Orange); + } msg.ReadPadBits(); + entities.Add(null); if (thisEventID == (UInt16)(lastReceivedID + 1)) lastReceivedID++; continue; }