Reconnect is now possible.

This commit is contained in:
Jocke
2016-02-10 21:02:46 +01:00
parent 95fa1f4bbd
commit ec54b1298d
5 changed files with 19 additions and 3 deletions
+3 -2
View File
@@ -58,13 +58,14 @@ void Client::Update()
}
if (m_IsConnected) {
hasServerTimedOut();
// Don't send 1 input in 1 packet, bunch em up.
if (m_SendInputIntervalMs < (1000 * (std::clock() - m_TimeSinceSentInputs) / (double)CLOCKS_PER_SEC)) {
sendInputCommands();
m_TimeSinceSentInputs = std::clock();
}
sendLocalPlayerTransform();
m_IsConnected = !hasServerTimedOut();
}
//Network::Update();
}
@@ -380,7 +381,7 @@ bool Client::hasServerTimedOut()
if (timeSincePing > m_TimeoutMs) {
// Clear everything and go to menu.
LOG_INFO("Server has timed out, returning to menu, Beep Boop.");
m_IsConnected = false;
m_Reliable.Disconnect();
return true;
}
return false;