Commit progression

This commit is contained in:
Lynix
2017-01-27 14:48:31 +01:00
parent 12b4073033
commit 8a59dc88b8
11 changed files with 865 additions and 811 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2017 Jérôme Leclercq
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Engine - Network module"
// For conditions of distribution and use, see copyright notice in Config.hpp
@@ -40,7 +40,7 @@ namespace Nz
std::size_t referenceCount = 0;
};
struct ENetPacketRef
struct NAZARA_NETWORK_API ENetPacketRef
{
ENetPacketRef() = default;
@@ -49,6 +49,18 @@ namespace Nz
Reset(packet);
}
ENetPacketRef(const ENetPacketRef& packet) :
ENetPacketRef()
{
Reset(packet);
}
ENetPacketRef(ENetPacketRef&& packet) :
m_packet(packet.m_packet)
{
packet.m_packet = nullptr;
}
~ENetPacketRef()
{
Reset();
@@ -69,6 +81,23 @@ namespace Nz
ENetPacketRef& operator=(ENetPacket* packet)
{
Reset(packet);
return *this;
}
ENetPacketRef& operator=(const ENetPacketRef& packet)
{
Reset(packet);
return *this;
}
ENetPacketRef& operator=(ENetPacketRef&& packet)
{
m_packet = packet.m_packet;
packet.m_packet = nullptr;
return *this;
}
ENetPacket* m_packet = nullptr;