Converted applicable enumerations to strongly typed enumerations.

This commit is contained in:
binary1248 2017-04-04 01:13:07 +02:00
parent b3b094fc91
commit 24db1dba1a
74 changed files with 1242 additions and 1251 deletions

View file

@ -16,7 +16,7 @@ void runUdpServer(unsigned short port)
sf::UdpSocket socket;
// Listen to messages on the specified port
if (socket.bind(port) != sf::Socket::Done)
if (socket.bind(port) != sf::Socket::Status::Done)
return;
std::cout << "Server is listening to port " << port << ", waiting for a message... " << std::endl;
@ -25,13 +25,13 @@ void runUdpServer(unsigned short port)
std::size_t received;
sf::IpAddress sender;
unsigned short senderPort;
if (socket.receive(in, sizeof(in), received, sender, senderPort) != sf::Socket::Done)
if (socket.receive(in, sizeof(in), received, sender, senderPort) != sf::Socket::Status::Done)
return;
std::cout << "Message received from client " << sender << ": \"" << in << "\"" << std::endl;
// Send an answer to the client
const char out[] = "Hi, I'm the server";
if (socket.send(out, sizeof(out), sender, senderPort) != sf::Socket::Done)
if (socket.send(out, sizeof(out), sender, senderPort) != sf::Socket::Status::Done)
return;
std::cout << "Message sent to the client: \"" << out << "\"" << std::endl;
}
@ -57,7 +57,7 @@ void runUdpClient(unsigned short port)
// Send a message to the server
const char out[] = "Hi, I'm a client";
if (socket.send(out, sizeof(out), server, port) != sf::Socket::Done)
if (socket.send(out, sizeof(out), server, port) != sf::Socket::Status::Done)
return;
std::cout << "Message sent to the server: \"" << out << "\"" << std::endl;
@ -66,7 +66,7 @@ void runUdpClient(unsigned short port)
std::size_t received;
sf::IpAddress sender;
unsigned short senderPort;
if (socket.receive(in, sizeof(in), received, sender, senderPort) != sf::Socket::Done)
if (socket.receive(in, sizeof(in), received, sender, senderPort) != sf::Socket::Status::Done)
return;
std::cout << "Message received from " << sender << ": \"" << in << "\"" << std::endl;
}