| 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 "ClientInformation.h" |
|---|
| 22 | //#include "enet/enet.h" |
|---|
| 23 | //#include "NetworkFrameListener.h" |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | namespace network{ |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | /** |
|---|
| 30 | * This class is the root class of the network module for a server. |
|---|
| 31 | * It implements all functions necessary for a Server |
|---|
| 32 | */ |
|---|
| 33 | class Server : public PacketDecoder{ |
|---|
| 34 | public: |
|---|
| 35 | Server(); |
|---|
| 36 | Server(int port, std::string bindAddress); |
|---|
| 37 | Server(int port, const char *bindAddress); |
|---|
| 38 | void open(); |
|---|
| 39 | void close(); |
|---|
| 40 | bool sendMSG(std::string msg); |
|---|
| 41 | bool sendMSG(const char *msg); |
|---|
| 42 | void tick(float time); |
|---|
| 43 | protected: |
|---|
| 44 | void processQueue(); |
|---|
| 45 | void updateGamestate(); |
|---|
| 46 | private: |
|---|
| 47 | bool sendGameState(); |
|---|
| 48 | ConnectionManager *connection; |
|---|
| 49 | GameStateManager *gamestates; |
|---|
| 50 | PacketGenerator packet_gen; |
|---|
| 51 | |
|---|
| 52 | ClientInformation *clients; |
|---|
| 53 | }; |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | #endif |
|---|
Note: See
TracBrowser
for help on using the repository browser.