23 lines
619 B
C++
23 lines
619 B
C++
#pragma once
|
|
|
|
#include <netinet/in.h>
|
|
#include <vector>
|
|
#include "bettola/network/tcpsocket.h"
|
|
#include "bettola/network/udpsocket.h"
|
|
#include "player.h"
|
|
|
|
class Game {
|
|
public:
|
|
Player* add_player(BettolaLib::Network::TCPSocket* socket);
|
|
void remove_player(unsigned int player_id);
|
|
|
|
void process_udp_message(const char* buffer, size_t size, const sockaddr_in& from_addr);
|
|
void broadcast_game_state(BettolaLib::Network::UDPSocket& udp_socket);
|
|
|
|
Player* get_player_by_socket(const BettolaLib::Network::TCPSocket* socket);
|
|
Player* get_player_by_id(unsigned int id);
|
|
|
|
private:
|
|
std::vector<Player*> _players;
|
|
};
|