author | terom |
Thu, 20 Nov 2008 19:25:56 +0000 | |
branch | no-netsession |
changeset 36 | 785d220fc6b7 |
parent 35 | e21cfda0edde |
permissions | -rw-r--r-- |
5 | 1 |
#ifndef NETWORKCLIENT_HH |
2 |
#define NETWORKCLIENT_HH |
|
3 |
||
21 | 4 |
#include "Network.hh" |
5 |
#include "GameState.hh" |
|
36 | 6 |
#include "NetworkSession.hh" |
7 |
#include "NetworkObject.hh" |
|
21 | 8 |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
9 |
// forward-declare |
26 | 10 |
class NetworkClientLocalPlayer; |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
11 |
class NetworkClientRemotePlayer; |
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
12 |
|
21 | 13 |
class NetworkClient : public NetworkCore { |
26 | 14 |
friend class NetworkClientLocalPlayer; |
15 |
friend class NetworkClientRemotePlayer; |
|
16 |
||
24 | 17 |
private: |
36 | 18 |
NetworkSession netsession; |
19 |
NetworkNode *server; |
|
20 |
||
21 |
NetworkObject_ClientController netobjs; |
|
24 | 22 |
|
23 |
public: |
|
36 | 24 |
NetworkClient (GameState &state, const NetworkAddress &connect_to); |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
25 |
|
24 | 26 |
private: |
36 | 27 |
void on_create (NetworkObject_Client *obj, NetworkMessageID msg_id, NetworkPacket &pkt); |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
28 |
|
36 | 29 |
void on_server_hello (NetworkObject_Client *obj, NetworkPacket &pkt); |
30 |
void on_player_info (NetworkObject_Client *obj, NetworkPacket &pkt); |
|
31 |
void on_player_join (NetworkObject_Client *obj, NetworkPacket &pkt); |
|
24 | 32 |
|
33 |
public: |
|
34 |
void player_quit (NetworkClientRemotePlayer *player); |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
35 |
}; |
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
36 |
|
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
37 |
class NetworkClientLocalPlayer : public LocalPlayer { |
24 | 38 |
private: |
39 |
NetworkClient &client; |
|
21 | 40 |
|
24 | 41 |
CL_SlotContainer slots; |
36 | 42 |
|
43 |
NetworkObject_Client *obj; |
|
24 | 44 |
|
45 |
public: |
|
36 | 46 |
NetworkClientLocalPlayer (NetworkClient &client, NetworkObject_Client *obj, Vector position); |
24 | 47 |
|
35 | 48 |
virtual void applyForce (Vector force, uint16_t dt); |
24 | 49 |
|
50 |
private: |
|
36 | 51 |
void on_position (NetworkPacket &pkt); |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
52 |
}; |
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
53 |
|
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
54 |
class NetworkClientRemotePlayer : public RemotePlayer { |
24 | 55 |
private: |
56 |
NetworkClient &client; |
|
57 |
||
58 |
CL_SlotContainer slots; |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
59 |
|
36 | 60 |
NetworkObject_Client *obj; |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
61 |
|
24 | 62 |
public: |
36 | 63 |
NetworkClientRemotePlayer (NetworkClient &client, NetworkObject_Client *obj, Vector position); |
24 | 64 |
|
65 |
private: |
|
36 | 66 |
void on_position (NetworkPacket &pkt); |
24 | 67 |
|
36 | 68 |
void on_quit (NetworkPacket &pkt); |
5 | 69 |
}; |
70 |
||
71 |
#endif |