Removed unnecessary unnecessary if in Client::OnInputCommand.

Change name from Server::parseEvent to Server::parseOnInputCommand
This commit is contained in:
Jocke
2016-01-13 18:00:12 +01:00
parent f47f913bf5
commit a060640da3
5 changed files with 14 additions and 11 deletions
+6 -7
View File
@@ -254,7 +254,6 @@ int Client::receive(char* data, size_t length)
if (error) {
LOG_ERROR("receive: %s", error.message().c_str());
}
return bytesReceived;
}
@@ -297,18 +296,18 @@ void Client::moveMessageHead(char*& data, size_t& length, size_t stepSize)
bool Client::OnInputCommand(const Events::InputCommand & e)
{
if (e.Command == "Forward" || e.Command == "Right") {
Packet packet(MessageType::Event, m_SendPacketID);
if (e.Command == "ConnectToServer") { // Connect for now
connect();
LOG_INFO("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
return true;
} else {
Packet packet(MessageType::OnInputCommand, m_SendPacketID);
packet.WriteString(e.Command);
packet.WritePrimitive(e.PlayerID);
packet.WritePrimitive(e.Value);
send(packet);
LOG_INFO("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 == "ConnectToServer") { // Connect for now
connect();
LOG_INFO("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
return true;
}
return false;
}