mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
* Adapt codebase to new class to reduce rune-like code. * Fixed several bugs where the global CClient pointer was used instead of the instance in question to issue bans and display information about a certain client in CBanSystem and Pylon. * Upgraded CBanSystem and Pylon to use IPv6 instead (including IPv4 mapped IPv6 addresses). This breaks all existing banlist files! All bans have to be re-issued or the existing file has to be updated to use IPv4 mapped IPv6 addresses and renamed to 'banlist.json', and moved to the root of the 'platform' folder.
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
#ifndef BITBUF_H
|
|
#define BITBUF_H
|
|
|
|
typedef enum
|
|
{
|
|
BITBUFERROR_VALUE_OUT_OF_RANGE = 0, // Tried to write a value with too few bits.
|
|
BITBUFERROR_BUFFER_OVERRUN, // Was about to overrun a buffer.
|
|
|
|
BITBUFERROR_NUM_ERRORS
|
|
} BitBufErrorType;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Used for serialization
|
|
//-----------------------------------------------------------------------------
|
|
struct bf_write
|
|
{
|
|
public:
|
|
// How many bytes are filled in?
|
|
int GetNumBytesWritten() const;
|
|
int GetNumBitsWritten() const;
|
|
int GetMaxNumBits() const;
|
|
int GetNumBitsLeft() const;
|
|
int GetNumBytesLeft() const;
|
|
unsigned char* GetData();
|
|
const unsigned char* GetData() const;
|
|
|
|
// Has the buffer overflowed?
|
|
bool CheckForOverflow(int nBits);
|
|
bool IsOverflowed() const;
|
|
void SetOverflowFlag();
|
|
private:
|
|
unsigned __int8* m_pData;
|
|
int m_nDataBytes;
|
|
int m_nDataBits;
|
|
int m_iCurBit;
|
|
bool m_bOverflow;
|
|
bool m_bAssertOnOverflow;
|
|
const char* m_pDebugName;
|
|
};
|
|
#endif // BITBUF_H
|