Protocol sources fixes (#5411)
* Move HANDLE_READ to header * Fix compiler warnings * Removed unnecessary default statement
This commit is contained in:
parent
21bcb2a757
commit
844a339330
@ -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
|
||||
{
|
||||
|
@ -48,19 +48,6 @@ Implements the 1.10 protocol classes:
|
||||
|
||||
|
||||
|
||||
#define HANDLE_READ(ByteBuf, Proc, Type, Var) \
|
||||
Type Var; \
|
||||
do { \
|
||||
if (!ByteBuf.Proc(Var))\
|
||||
{\
|
||||
return;\
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// The disabled error is intended, since the Metadata have overlapping indexes
|
||||
// based on the type of the Entity.
|
||||
//
|
||||
|
@ -316,19 +316,6 @@ namespace Metadata_1_11
|
||||
|
||||
|
||||
|
||||
#define HANDLE_READ(ByteBuf, Proc, Type, Var) \
|
||||
Type Var; \
|
||||
do { \
|
||||
if (!ByteBuf.Proc(Var))\
|
||||
{\
|
||||
return;\
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cProtocol_1_11_0:
|
||||
|
||||
|
@ -307,19 +307,6 @@ namespace Metadata_1_12
|
||||
|
||||
|
||||
|
||||
#define HANDLE_READ(ByteBuf, Proc, Type, Var) \
|
||||
Type Var; \
|
||||
do { \
|
||||
if (!ByteBuf.Proc(Var))\
|
||||
{\
|
||||
return;\
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cProtocol_1_12:
|
||||
|
||||
|
@ -41,36 +41,6 @@ Implements the 1.13 protocol classes:
|
||||
|
||||
|
||||
|
||||
#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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cProtocol_1_13:
|
||||
|
||||
|
@ -50,19 +50,6 @@ Implements the 1.14 protocol classes:
|
||||
|
||||
|
||||
|
||||
#define HANDLE_READ(ByteBuf, Proc, Type, Var) \
|
||||
Type Var; \
|
||||
do { \
|
||||
if (!ByteBuf.Proc(Var))\
|
||||
{\
|
||||
return;\
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cProtocol_1_14:
|
||||
|
||||
@ -733,6 +720,7 @@ UInt8 cProtocol_1_14::GetProtocolEntityType(const cEntity & a_Entity) const
|
||||
case PType::pkFirework: return 26;
|
||||
case PType::pkWitherSkull: return 92;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Type::etFloater: return 101;
|
||||
case Type::etItemFrame: return 35;
|
||||
|
@ -55,36 +55,6 @@ Implements the 1.8 protocol classes:
|
||||
|
||||
|
||||
|
||||
#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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const int MAX_ENC_LEN = 512; // Maximum size of the encrypted message; should be 128, but who knows...
|
||||
static const UInt32 CompressionThreshold = 256; // After how large a packet should we compress it.
|
||||
|
||||
|
@ -61,19 +61,6 @@ Implements the 1.9 protocol classes:
|
||||
|
||||
|
||||
|
||||
#define HANDLE_READ(ByteBuf, Proc, Type, Var) \
|
||||
Type Var; \
|
||||
do { \
|
||||
if (!ByteBuf.Proc(Var))\
|
||||
{\
|
||||
return;\
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cProtocol_1_9_0:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user