Network/ENetHost: Add GetServiceTime()

This commit is contained in:
Lynix 2017-01-31 22:19:17 +01:00
parent 4f1df53f07
commit 2f057191aa
3 changed files with 9 additions and 1 deletions

View File

@ -53,6 +53,8 @@ namespace Nz
void Flush();
inline UInt32 GetServiceTime() const;
int Service(ENetEvent* event, UInt32 timeout);
void SimulateNetwork(double packetLossProbability, UInt16 minDelay, UInt16 maxDelay);

View File

@ -51,6 +51,11 @@ namespace Nz
m_peers.clear();
m_socket.Close();
}
inline UInt32 Nz::ENetHost::GetServiceTime() const
{
return m_serviceTime;
}
}
#include <Nazara/Network/DebugOff.hpp>

View File

@ -474,7 +474,8 @@ namespace Nz
if (m_state == ENetPeerState::Disconnected || m_state == ENetPeerState::Zombie)
return true;
UInt32 serviceTime = m_host->m_serviceTime;
UInt32 serviceTime = m_host->GetServiceTime();
UInt32 receivedSentTime = NetToHost(command->acknowledge.receivedSentTime);
receivedSentTime |= serviceTime & 0xFFFF0000;
if ((receivedSentTime & 0x8000) > (serviceTime & 0x8000))