diff --git a/include/Nazara/Network/NetPacket.hpp b/include/Nazara/Network/NetPacket.hpp index f906a5431..1f950606b 100644 --- a/include/Nazara/Network/NetPacket.hpp +++ b/include/Nazara/Network/NetPacket.hpp @@ -28,6 +28,8 @@ namespace Nz NetPacket(NetPacket&&) = default; inline ~NetPacket(); + inline const UInt8* GetConstData() const; + inline UInt8* GetData() const; inline UInt16 GetNetCode() const; virtual void OnReceive(UInt16 netCode, const void* data, std::size_t size); diff --git a/include/Nazara/Network/NetPacket.inl b/include/Nazara/Network/NetPacket.inl index 23825966f..198354732 100644 --- a/include/Nazara/Network/NetPacket.inl +++ b/include/Nazara/Network/NetPacket.inl @@ -2,9 +2,10 @@ // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp -#include +#include #include #include +#include namespace Nz { @@ -28,6 +29,20 @@ namespace Nz FreeStream(); } + inline const UInt8* NetPacket::GetConstData() const + { + NazaraAssert(m_buffer, "Invalid buffer"); + + return m_buffer->GetConstBuffer(); + } + + inline UInt8* NetPacket::GetData() const + { + NazaraAssert(m_buffer, "Invalid buffer"); + + return m_buffer->GetBuffer(); + } + inline UInt16 NetPacket::GetNetCode() const { return m_netCode;