equal
deleted
inserted
replaced
1 #ifndef NETWORKSERVER_HH |
|
2 #define NETWORKSERVER_HH |
|
3 |
|
4 #include "Network.hh" |
|
5 #include "GameState.hh" |
|
6 #include "NetworkSession.hh" |
|
7 #include "NetworkObject.hh" |
|
8 |
|
9 #include <list> |
|
10 #include <map> |
|
11 #include <ClanLib/core.h> |
|
12 |
|
13 // forward-declare |
|
14 class NetworkServerPlayer; |
|
15 |
|
16 class NetworkServer : public NetworkCore { |
|
17 friend class NetworkServerPlayer; |
|
18 |
|
19 protected: |
|
20 NetworkSession netsession; |
|
21 NetworkObject_ServerController netobjs; |
|
22 std::list<NetworkServerPlayer *> players; |
|
23 |
|
24 public: |
|
25 NetworkServer (GameState &state, const NetworkAddress &listen_addr); |
|
26 |
|
27 protected: |
|
28 void handle_disconnect (NetworkServerPlayer *player); |
|
29 |
|
30 private: |
|
31 void on_node_connected (NetworkNode *node); |
|
32 }; |
|
33 |
|
34 class NetworkServerPlayer : public RemotePlayer { |
|
35 private: |
|
36 NetworkServer &server; |
|
37 NetworkObject_Server obj; |
|
38 NetworkNode *node; |
|
39 |
|
40 CL_SlotContainer slots; |
|
41 |
|
42 public: |
|
43 NetworkServerPlayer (NetworkServer &server, NetworkNode *node); |
|
44 |
|
45 private: |
|
46 void on_disconnected (void); |
|
47 void on_move (NetworkNode *node, NetworkPacket &pkt); |
|
48 |
|
49 void send_position_update (void); |
|
50 }; |
|
51 |
|
52 #endif |
|