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 NETWORK_HH |
2 |
#define NETWORK_HH |
|
3 |
||
21 | 4 |
#include "NetworkConfig.hh" |
5 |
#include "GameState.hh" |
|
6 |
||
13 | 7 |
#include <ClanLib/network.h> |
5 | 8 |
|
35 | 9 |
const int32_t COORDINATE_MAX = 1 << 30; |
10 |
||
21 | 11 |
class NetworkCore { |
24 | 12 |
protected: |
13 |
GameState &state; |
|
5 | 14 |
|
24 | 15 |
CL_SlotContainer slots; |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
16 |
|
24 | 17 |
// constructor |
32 | 18 |
NetworkCore (GameState &state) : state(state) { } |
35 | 19 |
|
20 |
||
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
21 |
}; |
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
22 |
|
36 | 23 |
enum NetworkChannel { |
24 |
/* |
|
25 |
* Core channel used for NetworkSession |
|
26 |
*/ |
|
27 |
NETCHAN_CORE = 0x01, |
|
28 |
}; |
|
35 | 29 |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
30 |
enum NetworkMessage { |
24 | 31 |
NETMSG_PACKET_INVALID = 0x00, |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
32 |
|
24 | 33 |
/* |
34 |
* You have joined the game: |
|
35 |
* |
|
35 | 36 |
* Vector initial_position |
24 | 37 |
*/ |
38 |
NETMSG_SERVER_HELLO = 0x0100, |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
39 |
|
24 | 40 |
/* |
41 |
* New client has connected to server: |
|
35 | 42 |
* |
43 |
* Vector initial_position |
|
24 | 44 |
*/ |
45 |
NETMSG_PLAYER_JOIN = 0x0101, |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
46 |
|
24 | 47 |
/* |
48 |
* Client has left server: |
|
49 |
* |
|
50 |
*/ |
|
51 |
NETMSG_PLAYER_QUIT = 0x0102, |
|
52 |
||
53 |
/* |
|
54 |
* Client has moved |
|
55 |
* |
|
35 | 56 |
* Vector impulse_force |
57 |
* uint16_t impulse_ms |
|
24 | 58 |
*/ |
59 |
NETMSG_CLIENT_MOVE = 0x0201, |
|
60 |
||
61 |
/* |
|
62 |
* Initial player info |
|
63 |
* |
|
35 | 64 |
* Vector initial_position |
24 | 65 |
*/ |
66 |
NETMSG_PLAYER_INFO = 0x0300, |
|
67 |
||
68 |
/* |
|
69 |
* Player position update |
|
70 |
* |
|
35 | 71 |
* Vector position |
72 |
* Vector velocity |
|
24 | 73 |
*/ |
74 |
NETMSG_PLAYER_POSITION = 0x0301, |
|
5 | 75 |
}; |
76 |
||
77 |
#endif |