diff --git a/Lidgren.Network/NetOutgoingMessage.Write.cs b/Lidgren.Network/NetOutgoingMessage.Write.cs index c66c7a5..82f5808 100644 --- a/Lidgren.Network/NetOutgoingMessage.Write.cs +++ b/Lidgren.Network/NetOutgoingMessage.Write.cs @@ -598,5 +598,23 @@ namespace Lidgren.Network m_bitLength -= excessBits; } } + + /// + /// Append all the bits of message to this message + /// + 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; + } + } } }