Commit 75343655 by Anselme
parents b684359f 5f46e056
All dependencies are provided in the repository.
You just need GCC or MinGW32, and qmake to set up the build.
For assets and binary files, we use git LFS, make sure you have it installed.
the project builds both the server and the client
......@@ -57,8 +57,10 @@ void SocketHandler::handleListenerMessage()
}
}
else
{
std::cout << "Connexion refused" << std::endl;
delete client;
}
}
void SocketHandler::handleSocketMessage(sf::TcpSocket& socket)
......@@ -162,16 +164,21 @@ bool SocketHandler::safeReceive(sf::TcpSocket &socket, sf::Packet &packet, bool
status = socket.receive(packet);
switch (status) {
case sf::Socket::Done:
std::cout << "receive ok" << std::endl;
return true;
case sf::Socket::NotReady:
std::cout << "receive not ready" << std::endl;
return false;
case sf::Socket::Partial:
std::cout << "partial receive" << std::endl;
retry=true;
break;
case sf::Socket::Disconnected:
std::cout << "disconnected client" << std::endl;
disconnectClient(socket);
return false;
case sf::Socket::Error:
std::cout << "error while receiving message" << std::endl;
default:
return false;
}
......@@ -189,15 +196,21 @@ bool SocketHandler::safeSend(sf::TcpSocket &socket, sf::Packet &packet, bool blo
status = socket.send(packet);
switch (status) {
case sf::Socket::Done:
std::cout << "send ok" << std::endl;
return true;
case sf::Socket::NotReady:
std::cout << "socket not ready" << std::endl;
return false;
case sf::Socket::Partial:
std::cout << "partial send" << std::endl;
retry=true;
break;
case sf::Socket::Disconnected:
std::cout << "socket disconnected" << std::endl;
disconnectClient(socket);
return false;
case sf::Socket::Error:
std::cout << "error while sending" << std::endl;
default:
return false;
}
......@@ -220,7 +233,6 @@ void SocketHandler::removeDisconnectedPlayer(){
player_remove.id = m_clients[to_erase].id;
players_disconnected << PLAYER_REMOVE;
players_disconnected << player_remove;
// m_id_list.erase(m_clients[to_erase].id);
m_clients.erase(to_erase);
}
m_to_erase.clear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment