Command: Replace binary_length field with auxiliary data

Use for CMD_ADD_PLAN_LINE
This commit is contained in:
Jonathan G Rennison
2022-12-07 20:37:23 +00:00
parent b0329ec77a
commit f32733ef22
23 changed files with 166 additions and 147 deletions

View File

@@ -85,6 +85,13 @@ bool Packet::CanWriteToPacket(size_t bytes_to_write)
return this->Size() + bytes_to_write <= this->limit;
}
void Packet::WriteAtOffset_uint16(size_t offset, uint16 data)
{
assert(offset + 1 < this->buffer.size());
this->buffer[offset] = GB(data, 0, 8);
this->buffer[offset + 1] = GB(data, 8, 8);
}
/*

View File

@@ -72,7 +72,9 @@ public:
PacketSize &GetDeserialisationPosition() { return this->pos; }
bool CanDeserialiseBytes(size_t bytes_to_read, bool raise_error) { return this->CanReadFromPacket(bytes_to_read, raise_error); }
bool CanWriteToPacket(size_t bytes_to_write);
bool CanWriteToPacket(size_t bytes_to_write);
void WriteAtOffset_uint16(size_t offset, uint16);
/* Reading/receiving of packets */
size_t ReadRawPacketSize() const;