From d412871de57790952ad0c52e837b39ad95f36dcc Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Sat, 20 Jul 2024 01:09:29 +0200 Subject: [PATCH] more use of NonCopyable --- include/blitz/network/EnetConnexion.h | 4 +++- include/blitz/network/EnetServer.h | 2 +- include/blitz/protocol/PacketVisitor.h | 2 +- include/blitz/protocol/Packets.h | 3 ++- src/blitz/network/EnetServer.cpp | 6 +++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/blitz/network/EnetConnexion.h b/include/blitz/network/EnetConnexion.h index 8d79ebc..3979ae9 100644 --- a/include/blitz/network/EnetConnexion.h +++ b/include/blitz/network/EnetConnexion.h @@ -5,8 +5,10 @@ * \brief File containing the blitz::network::EnetConnexion class */ +#include #include -#include +#include +#include namespace Nz { diff --git a/include/blitz/network/EnetServer.h b/include/blitz/network/EnetServer.h index 58c4d51..7d9709f 100644 --- a/include/blitz/network/EnetServer.h +++ b/include/blitz/network/EnetServer.h @@ -18,7 +18,7 @@ class EnetServer : private NonCopyable { void Destroy(); - void BroadcastPacket(const protocol::Packet& a_Packet, Nz::ENetPacketFlags a_Flags); + // void BroadcastPacket(const protocol::Packet& a_Packet, Nz::ENetPacketFlags a_Flags); EnetConnexion* GetConnexion(std::uint16_t a_PeerId); diff --git a/include/blitz/protocol/PacketVisitor.h b/include/blitz/protocol/PacketVisitor.h index 396bc7a..1f41f53 100644 --- a/include/blitz/protocol/PacketVisitor.h +++ b/include/blitz/protocol/PacketVisitor.h @@ -18,7 +18,7 @@ namespace protocol { * \class PacketVisitor * \brief This class uses double-dispatch in order to find the real type of a packet */ -class PacketVisitor { +class PacketVisitor : private NonCopyable { protected: PacketVisitor() {} virtual ~PacketVisitor() {} diff --git a/include/blitz/protocol/Packets.h b/include/blitz/protocol/Packets.h index 79e2918..cad1470 100644 --- a/include/blitz/protocol/Packets.h +++ b/include/blitz/protocol/Packets.h @@ -5,6 +5,7 @@ * \brief File containing the definitions of the packets */ +#include #include #include @@ -34,7 +35,7 @@ enum class PacketType : PacketID { #undef DeclarePacket -class Packet { +class Packet : private NonCopyable { public: /** * \return The real type of the packet diff --git a/src/blitz/network/EnetServer.cpp b/src/blitz/network/EnetServer.cpp index da17961..ffb094a 100644 --- a/src/blitz/network/EnetServer.cpp +++ b/src/blitz/network/EnetServer.cpp @@ -76,9 +76,9 @@ EnetConnexion* EnetServer::GetConnexion(std::uint16_t a_PeerId) { return &it->second; } -void EnetServer::BroadcastPacket(const protocol::Packet& a_Packet, Nz::ENetPacketFlags a_Flags) { - // m_Host.Broadcast(0, a_Flags, std::move(a_Data)); -} +/*void EnetServer::BroadcastPacket(const protocol::Packet& a_Packet, Nz::ENetPacketFlags a_Flags) { + m_Host.Broadcast(0, a_Flags, std::move(a_Data)); +}*/ void EnetServer::RemoveConnexion(std::uint16_t a_PeerId) { m_Connexion.erase(a_PeerId);