| Line | |
|---|
| 1 | // |
|---|
| 2 | // C++ Interface: Server |
|---|
| 3 | // |
|---|
| 4 | // Description: |
|---|
| 5 | // |
|---|
| 6 | // |
|---|
| 7 | // Author: Oliver Scheuss, (C) 2007 |
|---|
| 8 | // |
|---|
| 9 | // Copyright: See COPYING file that comes with this distribution |
|---|
| 10 | // |
|---|
| 11 | // |
|---|
| 12 | |
|---|
| 13 | #ifndef NETWORK_SERVER_H |
|---|
| 14 | #define NETWORK_SERVER_H |
|---|
| 15 | |
|---|
| 16 | #include <string> |
|---|
| 17 | |
|---|
| 18 | #include "ConnectionManager.h" |
|---|
| 19 | #include "PacketManager.h" |
|---|
| 20 | #include "GameStateManager.h" |
|---|
| 21 | #include "enet/enet.h" |
|---|
| 22 | |
|---|
| 23 | namespace network{ |
|---|
| 24 | |
|---|
| 25 | /** |
|---|
| 26 | * This class is the root class of the network module for a server. |
|---|
| 27 | * It implements all functions necessary for a Server |
|---|
| 28 | */ |
|---|
| 29 | class Server : PacketDecoder{ |
|---|
| 30 | public: |
|---|
| 31 | Server(); |
|---|
| 32 | Server(int port, std::string bindAddress); |
|---|
| 33 | Server(int port, const char *bindAddress); |
|---|
| 34 | void open(); |
|---|
| 35 | void close(); |
|---|
| 36 | bool sendMSG(std::string msg); |
|---|
| 37 | bool sendMSG(const char *msg); |
|---|
| 38 | void tick(); |
|---|
| 39 | private: |
|---|
| 40 | bool sendGameState(); |
|---|
| 41 | ConnectionManager connection; |
|---|
| 42 | GameStateManager gamestates; |
|---|
| 43 | PacketGenerator packet_gen; |
|---|
| 44 | |
|---|
| 45 | void processQueue(); |
|---|
| 46 | void updateGamestate(); |
|---|
| 47 | }; |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | #endif |
|---|
Note: See
TracBrowser
for help on using the repository browser.