71 uint16_t t = ENET_HOST_TO_NET_16(value);
82 uint32_t t = ENET_HOST_TO_NET_32(value);
95 int stringLength =
string.length();
100 length = stringLength;
102 else if (length < stringLength)
105 stringLength = length;
110 memcpy(
mData +
mPos,
string.data(), stringLength);
112 if (length > stringLength)
115 memset(
mData +
mPos + stringLength,
'\0', length - stringLength);
void writeInt16(uint16_t value)
Writes an unsigned 16-bit integer to the message.
bool mDebugMode
Include debugging information.
void writeInt32(uint32_t value)
Writes an unsigned 32-bit integer to the message.
void expand(size_t size)
Expand the packet data to be able to hold more data.
unsigned int mPos
Position in the data.
void writeValueType(ManaServ::ValueType type)
unsigned int mDataSize
Size of data.
void writeInt8(uint8_t value)
Writes an unsigned 8-bit integer to the message.
void writeString(const std::string &string, int length=-1)
Writes a string.
char * mData
Data building up.
ValueType
The type of a value in a message.