1234567891011121314151617181920212223242526272829303132333435 |
- #ifndef SERVER_H
- #define SERVER_H
- #include "common/network/ENet.h"
- #include "gaming-core/utils/Types.h"
- #include "server/GameServer.h"
- #include "gaming-core/utils/Array.h"
- #include "server/network/Client.h"
- class Server final {
- public:
- typedef uint16 Port;
-
- Server(Port 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);
- int getFreeIndex() const;
-
- ENetHost* server;
- Array<Client, 50> clients;
- };
- #endif
|