Fixed incorrectly length in character position updates (1 bit off), clients read pad bits in position updates

This commit is contained in:
Regalis
2017-04-12 23:44:58 +03:00
parent 9a36df0f52
commit f4c01f68ed
2 changed files with 3 additions and 0 deletions
@@ -455,6 +455,8 @@ namespace Barotrauma
tempBuffer.Write(SimPosition.X); tempBuffer.Write(SimPosition.X);
tempBuffer.Write(SimPosition.Y); tempBuffer.Write(SimPosition.Y);
tempBuffer.WritePadBits();
msg.Write((byte)tempBuffer.LengthBytes); msg.Write((byte)tempBuffer.LengthBytes);
msg.Write(tempBuffer); msg.Write(tempBuffer);
} }
@@ -932,6 +932,7 @@ namespace Barotrauma.Networking
//force to the correct position in case the entity doesn't exist //force to the correct position in case the entity doesn't exist
//or the message wasn't read correctly for whatever reason //or the message wasn't read correctly for whatever reason
inc.Position = msgEndPos; inc.Position = msgEndPos;
inc.ReadPadBits();
break; break;
case ServerNetObject.ENTITY_EVENT: case ServerNetObject.ENTITY_EVENT:
case ServerNetObject.ENTITY_EVENT_INITIAL: case ServerNetObject.ENTITY_EVENT_INITIAL: