123456789101112131415161718192021222324252627282930313233 |
- #ifndef SERVER_H
- #define SERVER_H
- #include "common/enet/enet.h"
- #include "common/utils/Types.h"
- #include "server/GameServer.h"
- #include "common/utils/Array.h"
- #include "server/network/Client.h"
- class Server final {
- public:
- Server(u16 port);
- ~Server();
- Server(const Server&) = delete;
- Server& operator=(const Server&) = delete;
- Server(Server&&) = delete;
- Server& operator=(Server&&) = delete;
- bool hasError() const;
- void consumeEvents(GameServer& gameServer);
- private:
- void onConnect(ENetEvent& event, GameServer& gameServer);
- void onPackage(ENetEvent& event, GameServer& gameServer);
- void onDisconnect(ENetEvent& event, GameServer& gameServer);
- uint getFreeIndex() const;
-
- ENetHost* server;
- Array<Client, 50> clients;
- };
- #endif
|