Core/SerializationContext: Replaced currentBitPos and currentByte by [read|write][BitPos][Byte] to handle properly bit reading/writing

This commit is contained in:
Jérôme Leclercq
2018-05-31 16:10:58 +02:00
parent 33fb70b65b
commit 550176e198
5 changed files with 36 additions and 24 deletions

View File

@@ -19,16 +19,16 @@ namespace Nz
/*!
* Write bits to the stream (if any) and reset the current bit cursor
* \see ResetBitPosition
* \see ResetWriteBitPosition
*/
void SerializationContext::FlushBits()
{
if (currentBitPos != 8)
if (writeBitPos != 8)
{
ResetBitPosition();
ResetWriteBitPosition();
// Serialize will reset the bit position
if (!Serialize(*this, currentByte))
if (!Serialize(*this, writeByte))
NazaraWarning("Failed to flush bits");
}
}