Network/ENetHost: Expose AllocatePacket
This commit is contained in:
@@ -44,6 +44,9 @@ namespace Nz
|
||||
ENetHost(ENetHost&&) = default;
|
||||
inline ~ENetHost();
|
||||
|
||||
ENetPacketRef AllocatePacket(ENetPacketFlags flags);
|
||||
inline ENetPacketRef AllocatePacket(ENetPacketFlags flags, NetPacket&& data);
|
||||
|
||||
inline void AllowsIncomingConnections(bool allow = true);
|
||||
|
||||
void Broadcast(UInt8 channelId, ENetPacketFlags flags, NetPacket&& packet);
|
||||
@@ -79,9 +82,6 @@ namespace Nz
|
||||
ENetHost& operator=(ENetHost&&) = default;
|
||||
|
||||
private:
|
||||
ENetPacketRef AllocatePacket(ENetPacketFlags flags);
|
||||
inline ENetPacketRef AllocatePacket(ENetPacketFlags flags, NetPacket&& data);
|
||||
|
||||
bool InitSocket(const IpAddress& address);
|
||||
|
||||
void AddToDispatchQueue(ENetPeer* peer);
|
||||
|
||||
@@ -20,6 +20,14 @@ namespace Nz
|
||||
Destroy();
|
||||
}
|
||||
|
||||
inline ENetPacketRef ENetHost::AllocatePacket(ENetPacketFlags flags, NetPacket&& data)
|
||||
{
|
||||
ENetPacketRef ref = AllocatePacket(flags);
|
||||
ref->data = std::move(data);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
inline void ENetHost::AllowsIncomingConnections(bool allow)
|
||||
{
|
||||
NazaraAssert(m_address.IsValid() && !m_address.IsLoopback(), "Only server hosts can allow incoming connections");
|
||||
@@ -101,14 +109,6 @@ namespace Nz
|
||||
m_compressor = std::move(compressor);
|
||||
}
|
||||
|
||||
inline ENetPacketRef ENetHost::AllocatePacket(ENetPacketFlags flags, NetPacket&& data)
|
||||
{
|
||||
ENetPacketRef ref = AllocatePacket(flags);
|
||||
ref->data = std::move(data);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
inline void ENetHost::UpdateServiceTime()
|
||||
{
|
||||
// Compute service time as microseconds for extra precision
|
||||
|
||||
Reference in New Issue
Block a user