Merge branch 'Networking' of github.com:teamfisk/TacticalZ into Networking

# Conflicts:
#	src/Engine/Network/Client.cpp
This commit is contained in:
Jocke
2016-01-20 14:33:17 +01:00
+10 -4
View File
@@ -238,8 +238,7 @@ void Client::connect()
void Client::disconnect()
{
Packet packet(MessageType::Connect, m_SendPacketID);
packet.WriteString("+Disconnect");
Packet packet(MessageType::Disconnect, m_SendPacketID);
send(packet);
}
@@ -254,9 +253,16 @@ void Client::ping()
bool Client::OnInputCommand(const Events::InputCommand & e)
{
if (e.Command == "ConnectToServer") { // Connect for now
connect();
if (e.Value > 0) {
connect();
}
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
return true;
} else if (e.Command == "DisconnectFromServer") {
if (e.Value > 0) {
disconnect();
}
return true;
} else {
m_InputCommandBuffer.push_back(e);
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
@@ -280,7 +286,7 @@ void Client::identifyPacketLoss()
// if no packets lost, difference should be equal to 1
int difference = m_PacketID - m_PreviousPacketID;
if (difference != 1) {
LOG_INFO("%i Packet(s) were lost...", difference -1);
LOG_INFO("%i Packet(s) were lost...", difference - 1);
}
}