author | terom |
Thu, 20 Nov 2008 19:25:56 +0000 | |
branch | no-netsession |
changeset 36 | 785d220fc6b7 |
parent 32 | 2ff929186c90 |
permissions | -rw-r--r-- |
5 | 1 |
#ifndef NETWORKSERVER_HH |
2 |
#define NETWORKSERVER_HH |
|
3 |
||
6 | 4 |
#include "Network.hh" |
5 |
#include "GameState.hh" |
|
36 | 6 |
#include "NetworkSession.hh" |
7 |
#include "NetworkObject.hh" |
|
6 | 8 |
|
5 | 9 |
#include <list> |
6 | 10 |
#include <map> |
11 |
#include <ClanLib/core.h> |
|
5 | 12 |
|
6 | 13 |
// forward-declare |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
14 |
class NetworkServerPlayer; |
6 | 15 |
|
21 | 16 |
class NetworkServer : public NetworkCore { |
24 | 17 |
friend class NetworkServerPlayer; |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
18 |
|
36 | 19 |
protected: |
20 |
NetworkSession netsession; |
|
21 |
NetworkObject_ServerController netobjs; |
|
22 |
std::list<NetworkServerPlayer *> players; |
|
5 | 23 |
|
24 | 24 |
public: |
32 | 25 |
NetworkServer (GameState &state, const NetworkAddress &listen_addr); |
36 | 26 |
|
27 |
protected: |
|
28 |
void handle_disconnect (NetworkServerPlayer *player); |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
29 |
|
24 | 30 |
private: |
36 | 31 |
void on_node_connected (NetworkNode *node); |
5 | 32 |
}; |
33 |
||
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
34 |
class NetworkServerPlayer : public RemotePlayer { |
24 | 35 |
private: |
36 |
NetworkServer &server; |
|
36 | 37 |
NetworkObject_Server obj; |
38 |
NetworkNode *node; |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
39 |
|
24 | 40 |
CL_SlotContainer slots; |
41 |
||
42 |
public: |
|
36 | 43 |
NetworkServerPlayer (NetworkServer &server, NetworkNode *node); |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
44 |
|
24 | 45 |
private: |
32 | 46 |
void on_disconnected (void); |
36 | 47 |
void on_move (NetworkNode *node, NetworkPacket &pkt); |
24 | 48 |
|
49 |
void send_position_update (void); |
|
5 | 50 |
}; |
51 |
||
52 |
#endif |