1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-15 22:56:30 +09:00

Added NetOutgoingMessage.Write(NetIncomingMessage)

This commit is contained in:
lidgren
2011-02-17 17:23:35 +00:00
parent de6d449043
commit 3a02fc25e9

View File

@@ -598,5 +598,23 @@ namespace Lidgren.Network
m_bitLength -= excessBits;
}
}
/// <summary>
/// Append all the bits of message to this message
/// </summary>
public void Write(NetIncomingMessage message)
{
EnsureBufferSize(m_bitLength + (message.LengthBytes * 8));
Write(message.m_data, 0, message.LengthBytes);
// did we write excessive bits?
int bitsInLastByte = (message.m_bitLength % 8);
if (bitsInLastByte != 0)
{
int excessBits = 8 - bitsInLastByte;
m_bitLength -= excessBits;
}
}
}
}