Last change
on this file since 473 was
459,
checked in by scheusso, 17 years ago
|
preparing clone mode for game (one server steers, all clients view )
|
File size:
1.1 KB
|
Rev | Line | |
---|
[230] | 1 | // |
---|
| 2 | // C++ Interface: Server |
---|
| 3 | // |
---|
[285] | 4 | // Description: |
---|
[230] | 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 | |
---|
[285] | 18 | #include "ConnectionManager.h" |
---|
| 19 | #include "PacketManager.h" |
---|
[413] | 20 | #include "GameStateManager.h" |
---|
[369] | 21 | #include "enet/enet.h" |
---|
[436] | 22 | #include "ClientInformation.h" |
---|
[459] | 23 | //#include "NetworkFrameListener.h" |
---|
[230] | 24 | |
---|
[459] | 25 | |
---|
[230] | 26 | namespace network{ |
---|
[285] | 27 | |
---|
[459] | 28 | |
---|
[230] | 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 : PacketDecoder{ |
---|
| 34 | public: |
---|
| 35 | Server(); |
---|
| 36 | Server(int port, std::string bindAddress); |
---|
| 37 | Server(int port, const char *bindAddress); |
---|
[369] | 38 | void open(); |
---|
| 39 | void close(); |
---|
| 40 | bool sendMSG(std::string msg); |
---|
| 41 | bool sendMSG(const char *msg); |
---|
[459] | 42 | void tick(float time); |
---|
[440] | 43 | protected: |
---|
| 44 | void processQueue(); |
---|
| 45 | void updateGamestate(); |
---|
[230] | 46 | private: |
---|
[422] | 47 | bool sendGameState(); |
---|
[436] | 48 | ConnectionManager *connection; |
---|
| 49 | GameStateManager *gamestates; |
---|
[369] | 50 | PacketGenerator packet_gen; |
---|
[380] | 51 | |
---|
[436] | 52 | ClientInformation *clients; |
---|
[230] | 53 | }; |
---|
[459] | 54 | |
---|
[285] | 55 | |
---|
| 56 | |
---|
| 57 | |
---|
[230] | 58 | } |
---|
| 59 | |
---|
| 60 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.