Added demowriter check for num bits written being a multiple of 8

This commit is contained in:
Jordan Cristiano 2015-06-25 09:02:08 -04:00
parent b0e5506384
commit 9696646576

View File

@ -62,6 +62,11 @@ void DemoWriter::EndCommandPacket(const PacketTrailingBits& trailingBits)
{ {
m_cmdPacketBuf.WriteUBitLong(trailingBits.value, trailingBits.numTrailingBits); m_cmdPacketBuf.WriteUBitLong(trailingBits.value, trailingBits.numTrailingBits);
} }
const int numBitsToWrite = m_cmdPacketBuf.GetNumBitsWritten() % 8;
if (numBitsToWrite != 0)
{
assert(false);
}
if (m_cmdPacketBuf.GetNumBytesWritten() > 0) if (m_cmdPacketBuf.GetNumBytesWritten() > 0)
{ {
m_writer.WriteRawData(m_cmdPacketBuf.GetBasePointer(), m_cmdPacketBuf.GetNumBytesWritten()); m_writer.WriteRawData(m_cmdPacketBuf.GetBasePointer(), m_cmdPacketBuf.GetNumBytesWritten());