diff options
author | Simon Pribylski <66266021+Persson-dev@users.noreply.github.com> | 2022-04-21 18:05:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-21 18:05:09 +0200 |
commit | 844a33933076a8e343de944b6eab26b4166e2f6f (patch) | |
tree | f1c69581153d462e40d116e117713c95aae1f84c /src/Protocol/Packetizer.h | |
parent | Improving 1.14 support (#5388) (diff) | |
download | cuberite-844a33933076a8e343de944b6eab26b4166e2f6f.tar cuberite-844a33933076a8e343de944b6eab26b4166e2f6f.tar.gz cuberite-844a33933076a8e343de944b6eab26b4166e2f6f.tar.bz2 cuberite-844a33933076a8e343de944b6eab26b4166e2f6f.tar.lz cuberite-844a33933076a8e343de944b6eab26b4166e2f6f.tar.xz cuberite-844a33933076a8e343de944b6eab26b4166e2f6f.tar.zst cuberite-844a33933076a8e343de944b6eab26b4166e2f6f.zip |
Diffstat (limited to 'src/Protocol/Packetizer.h')
-rw-r--r-- | src/Protocol/Packetizer.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/Protocol/Packetizer.h b/src/Protocol/Packetizer.h index 679a26af4..ccf7234cd 100644 --- a/src/Protocol/Packetizer.h +++ b/src/Protocol/Packetizer.h @@ -24,6 +24,37 @@ class cUUID; +/** Macros used to read packets more easily */ +#define HANDLE_READ(ByteBuf, Proc, Type, Var) \ + Type Var; \ + do { \ + if (!ByteBuf.Proc(Var))\ + {\ + return;\ + } \ + } while (false) + + + + + +#define HANDLE_PACKET_READ(ByteBuf, Proc, Type, Var) \ + Type Var; \ + do { \ + { \ + if (!ByteBuf.Proc(Var)) \ + { \ + ByteBuf.CheckValid(); \ + return false; \ + } \ + ByteBuf.CheckValid(); \ + } \ + } while (false) + + + + + /** Composes an individual packet in the protocol's m_OutPacketBuffer; sends it just before being destructed. */ class cPacketizer { |