From eb3ca16921080b1496d2e71de95ce533929241e1 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 4 May 2020 11:50:02 +0100 Subject: Fix one definition rule violations --- src/Protocol/Protocol_1_11.cpp | 8 ++++---- src/Protocol/Protocol_1_12.cpp | 8 ++++---- src/Protocol/Protocol_1_8.cpp | 10 +++------- src/Protocol/Protocol_1_9.cpp | 6 +++--- 4 files changed, 14 insertions(+), 18 deletions(-) (limited to 'src/Protocol') diff --git a/src/Protocol/Protocol_1_11.cpp b/src/Protocol/Protocol_1_11.cpp index 677662a6f..b12b45814 100644 --- a/src/Protocol/Protocol_1_11.cpp +++ b/src/Protocol/Protocol_1_11.cpp @@ -58,9 +58,9 @@ Implements the 1.11 protocol classes: #pragma clang diagnostic ignored "-Wduplicate-enum" #endif -namespace Metadata +namespace Metadata_1_11 { - enum Metadata_Index + enum MetadataIndex { // Entity ENTITY_FLAGS, @@ -653,7 +653,7 @@ void cProtocol_1_11_0::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) { - using namespace Metadata; + using namespace Metadata_1_11; // Common metadata: Int8 Flags = 0; @@ -860,7 +860,7 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) { - using namespace Metadata; + using namespace Metadata_1_11; // Living Enitiy Metadata if (a_Mob.HasCustomName()) diff --git a/src/Protocol/Protocol_1_12.cpp b/src/Protocol/Protocol_1_12.cpp index 8cf8df6ca..d2e7b2071 100644 --- a/src/Protocol/Protocol_1_12.cpp +++ b/src/Protocol/Protocol_1_12.cpp @@ -42,9 +42,9 @@ Implements the 1.12 protocol classes: #pragma clang diagnostic ignored "-Wduplicate-enum" #endif -namespace Metadata +namespace Metadata_1_12 { - enum Metadata_Index + enum MetadataIndex { // Entity ENTITY_FLAGS, @@ -372,7 +372,7 @@ void cProtocol_1_12::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_Entity) { - using namespace Metadata; + using namespace Metadata_1_12; // Common metadata: Int8 Flags = 0; @@ -579,7 +579,7 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mob) { - using namespace Metadata; + using namespace Metadata_1_12; // Living Enitiy Metadata if (a_Mob.HasCustomName()) diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index 4aa312fef..fe2f80146 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -54,13 +54,6 @@ Implements the 1.8 protocol classes: -/** The slot number that the client uses to indicate "outside the window". */ -static const Int16 SLOT_NUM_OUTSIDE = -999; - - - - - #define HANDLE_READ(ByteBuf, Proc, Type, Var) \ Type Var; \ do { \ @@ -2825,6 +2818,9 @@ void cProtocol_1_8_0::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer) cItem Item; ReadItem(a_ByteBuffer, Item); + /** The slot number that the client uses to indicate "outside the window". */ + static const Int16 SLOT_NUM_OUTSIDE = -999; + // Convert Button, Mode, SlotNum and HeldItem into eClickAction: eClickAction Action; switch ((Mode << 8) | Button) diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index 150e81339..ff62df242 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -58,9 +58,6 @@ Implements the 1.9 protocol classes: -/** The slot number that the client uses to indicate "outside the window". */ -static const Int16 SLOT_NUM_OUTSIDE = -999; - /** Value for main hand in Hand parameter for Protocol 1.9. */ static const UInt32 MAIN_HAND = 0; static const UInt32 OFF_HAND = 1; @@ -1034,6 +1031,9 @@ void cProtocol_1_9_0::HandlePacketWindowClick(cByteBuffer & a_ByteBuffer) cItem Item; ReadItem(a_ByteBuffer, Item); + /** The slot number that the client uses to indicate "outside the window". */ + static const Int16 SLOT_NUM_OUTSIDE = -999; + // Convert Button, Mode, SlotNum and HeldItem into eClickAction: eClickAction Action; switch ((Mode << 8) | Button) -- cgit v1.2.3