Network/ENetHost: Add GetServiceTime()
This commit is contained in:
parent
4f1df53f07
commit
2f057191aa
|
|
@ -53,6 +53,8 @@ namespace Nz
|
||||||
|
|
||||||
void Flush();
|
void Flush();
|
||||||
|
|
||||||
|
inline UInt32 GetServiceTime() const;
|
||||||
|
|
||||||
int Service(ENetEvent* event, UInt32 timeout);
|
int Service(ENetEvent* event, UInt32 timeout);
|
||||||
|
|
||||||
void SimulateNetwork(double packetLossProbability, UInt16 minDelay, UInt16 maxDelay);
|
void SimulateNetwork(double packetLossProbability, UInt16 minDelay, UInt16 maxDelay);
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,11 @@ namespace Nz
|
||||||
m_peers.clear();
|
m_peers.clear();
|
||||||
m_socket.Close();
|
m_socket.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline UInt32 Nz::ENetHost::GetServiceTime() const
|
||||||
|
{
|
||||||
|
return m_serviceTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Nazara/Network/DebugOff.hpp>
|
#include <Nazara/Network/DebugOff.hpp>
|
||||||
|
|
|
||||||
|
|
@ -474,7 +474,8 @@ namespace Nz
|
||||||
if (m_state == ENetPeerState::Disconnected || m_state == ENetPeerState::Zombie)
|
if (m_state == ENetPeerState::Disconnected || m_state == ENetPeerState::Zombie)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
UInt32 serviceTime = m_host->m_serviceTime;
|
UInt32 serviceTime = m_host->GetServiceTime();
|
||||||
|
|
||||||
UInt32 receivedSentTime = NetToHost(command->acknowledge.receivedSentTime);
|
UInt32 receivedSentTime = NetToHost(command->acknowledge.receivedSentTime);
|
||||||
receivedSentTime |= serviceTime & 0xFFFF0000;
|
receivedSentTime |= serviceTime & 0xFFFF0000;
|
||||||
if ((receivedSentTime & 0x8000) > (serviceTime & 0x8000))
|
if ((receivedSentTime & 0x8000) > (serviceTime & 0x8000))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue