+ struct BlockUpdate : public Payload {
+ static constexpr std::uint8_t TYPE = 11;
+ static constexpr std::size_t MAX_LEN = 484;
+
+ static constexpr std::uint32_t MAX_BLOCKS = 78;
+ static constexpr std::size_t GetSize(std::uint32_t num) noexcept {
+ return 16 + (num * 6);
+ }
+
+ void WriteChunkCoords(const glm::ivec3 &) noexcept;
+ void ReadChunkCoords(glm::ivec3 &) const noexcept;
+ void WriteBlockCount(std::uint32_t) noexcept;
+ void ReadBlockCount(std::uint32_t &) const noexcept;
+
+ void WriteIndex(std::uint16_t, std::uint32_t) noexcept;
+ void ReadIndex(std::uint16_t &, std::uint32_t) const noexcept;
+ void WriteBlock(const Block &, std::uint32_t) noexcept;
+ void ReadBlock(Block &, std::uint32_t) const noexcept;
+ };
+
+ struct Message : public Payload {
+ static constexpr std::uint8_t TYPE = 12;
+ static constexpr std::size_t MAX_LEN = 455;
+
+ static constexpr std::size_t MAX_MESSAGE_LEN = 450;
+ static std::size_t GetSize(const std::string &msg) noexcept {
+ return 5 + std::min(msg.size() + 1, MAX_MESSAGE_LEN);
+ }
+
+ void WriteType(std::uint8_t) noexcept;
+ void ReadType(std::uint8_t &) const noexcept;
+ void WriteReferral(std::uint32_t) noexcept;
+ void ReadReferral(std::uint32_t &) const noexcept;
+ void WriteMessage(const std::string &) noexcept;
+ void ReadMessage(std::string &) const noexcept;
+ };
+