| author | terom |
| Mon, 10 Nov 2008 16:49:09 +0000 | |
| branch | no-netsession |
| changeset 31 | d0d7489d4e8b |
| parent 24 | b81cb670e6b2 |
| child 32 | 2ff929186c90 |
| child 89 | 825c4613e087 |
| permissions | -rw-r--r-- |
| 5 | 1 |
#ifndef NETWORKSERVER_HH |
2 |
#define NETWORKSERVER_HH |
|
3 |
||
| 6 | 4 |
#include "Network.hh" |
5 |
#include "GameState.hh" |
|
6 |
||
| 5 | 7 |
#include <list> |
| 6 | 8 |
#include <map> |
9 |
#include <ClanLib/core.h> |
|
| 5 | 10 |
|
| 6 | 11 |
// forward-declare |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
12 |
class NetworkServerPlayer; |
| 6 | 13 |
|
| 21 | 14 |
class NetworkServer : public NetworkCore {
|
| 24 | 15 |
friend class NetworkServerPlayer; |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
16 |
|
| 24 | 17 |
private: |
18 |
uint16_t pid_pool; |
|
19 |
||
20 |
public: |
|
21 |
std::map<CL_NetComputer, NetworkServerPlayer*> players; |
|
| 5 | 22 |
|
| 24 | 23 |
public: |
24 |
NetworkServer (GameState &state, const std::string &listen_port); |
|
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
25 |
|
| 24 | 26 |
private: |
27 |
void on_connect (CL_NetComputer &computer); |
|
28 |
void on_disconnect (CL_NetComputer &computer); |
|
29 |
||
30 |
||
| 5 | 31 |
}; |
32 |
||
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
33 |
class NetworkServerPlayer : public RemotePlayer {
|
| 24 | 34 |
private: |
35 |
NetworkServer &server; |
|
36 |
CL_NetComputer &computer; |
|
37 |
CL_NetObject_Server obj; |
|
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
38 |
|
| 24 | 39 |
CL_SlotContainer slots; |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
40 |
|
| 24 | 41 |
uint16_t pid; |
42 |
||
43 |
public: |
|
44 |
NetworkServerPlayer (NetworkServer &server, CL_NetComputer &computer, uint16_t pid); |
|
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
45 |
|
| 24 | 46 |
void disconnected (void); |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
47 |
|
| 24 | 48 |
private: |
49 |
void on_move (CL_NetComputer &from, CL_NetPacket &pkt); |
|
50 |
||
51 |
void send_position_update (void); |
|
| 5 | 52 |
}; |
53 |
||
54 |
#endif |