1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 07:06:30 +09:00

Fix for fragmented messages and ReliableOrdered

This commit is contained in:
lidgren
2010-06-15 22:37:30 +00:00
parent 5d44e391cb
commit a12fc42732
4 changed files with 36 additions and 12 deletions

View File

@@ -438,7 +438,17 @@ namespace Lidgren.Network
}
byte[] bytes = Encoding.UTF8.GetBytes(source);
InternalEnsureBufferSize(m_bitLength + (bytes.Length > 127 ? 2 * 8 : 1 * 8) + (bytes.Length * 8));
// determine number of bytes to store length
int lenBytesNeeded = 1;
uint num1 = (uint)bytes.Length;
while (num1 >= 0x80)
{
num1 = num1 >> 7;
lenBytesNeeded++;
}
InternalEnsureBufferSize(m_bitLength + ((bytes.Length + lenBytesNeeded) * 8));
WriteVariableUInt32((uint)bytes.Length);
Write(bytes);
}