[Server] Added parameter 'port' for init().
This commit is contained in:
parent
389ee41f05
commit
7caeafb845
@ -22,7 +22,7 @@
|
||||
|
||||
class Server {
|
||||
public:
|
||||
void init();
|
||||
void init(u16 port = 4242);
|
||||
|
||||
void handleKeyState();
|
||||
|
||||
|
@ -20,7 +20,7 @@ ServerApplication::ServerApplication(int argc, char **argv) : gk::CoreApplicatio
|
||||
void ServerApplication::init() {
|
||||
gk::CoreApplication::init();
|
||||
|
||||
m_server.init();
|
||||
m_server.init(4242);
|
||||
m_server.setRunning(true);
|
||||
m_server.setGameStarted(false);
|
||||
|
||||
@ -36,6 +36,7 @@ void ServerApplication::mainLoop() {
|
||||
m_server.handleKeyState();
|
||||
|
||||
m_clock.updateGame([&] {
|
||||
// TODO
|
||||
});
|
||||
|
||||
m_clock.waitForNextFrame();
|
||||
|
@ -14,13 +14,13 @@
|
||||
#include "Network.hpp"
|
||||
#include "Server.hpp"
|
||||
|
||||
void Server::init() {
|
||||
if (m_udpSocket.bind(4242) != sf::Socket::Done)
|
||||
void Server::init(u16 port) {
|
||||
if (m_udpSocket.bind(port) != sf::Socket::Done)
|
||||
throw EXCEPTION("Network error: Bind failed");
|
||||
|
||||
m_udpSocket.setBlocking(false);
|
||||
|
||||
if (m_tcpListener.listen(4242) != sf::Socket::Done)
|
||||
if (m_tcpListener.listen(port) != sf::Socket::Done)
|
||||
throw EXCEPTION("Network error: Listen failed");
|
||||
|
||||
m_tcpListener.setBlocking(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user