author | terom |
Mon, 10 Nov 2008 18:21:23 +0000 | |
branch | no-netsession |
changeset 32 | 2ff929186c90 |
parent 25 | af75a1894a32 |
child 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 |
|
21 | 9 |
class NetworkCore { |
24 | 10 |
protected: |
11 |
GameState &state; |
|
5 | 12 |
|
24 | 13 |
CL_SlotContainer slots; |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
14 |
|
24 | 15 |
// constructor |
32 | 16 |
NetworkCore (GameState &state) : state(state) { } |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
17 |
}; |
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
18 |
|
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
19 |
enum NetworkMessage { |
24 | 20 |
NETMSG_PACKET_INVALID = 0x00, |
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
21 |
|
24 | 22 |
/* |
23 |
* You have joined the game: |
|
24 |
* |
|
25 |
* uint32_t x |
|
26 |
* uint32_t y |
|
27 |
*/ |
|
28 |
NETMSG_SERVER_HELLO = 0x0100, |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
29 |
|
24 | 30 |
/* |
31 |
* New client has connected to server: |
|
32 |
* |
|
33 |
* uint32_t x |
|
34 |
* uint32_t y |
|
35 |
*/ |
|
36 |
NETMSG_PLAYER_JOIN = 0x0101, |
|
22
b70d30e1b0fe
all the network code is now there, although it doesn't quite work
terom
parents:
21
diff
changeset
|
37 |
|
24 | 38 |
/* |
39 |
* Client has left server: |
|
40 |
* |
|
41 |
*/ |
|
42 |
NETMSG_PLAYER_QUIT = 0x0102, |
|
43 |
||
44 |
/* |
|
45 |
* Client has moved |
|
46 |
* |
|
25 | 47 |
* int32_t dx |
48 |
* int32_t dy |
|
24 | 49 |
*/ |
50 |
NETMSG_CLIENT_MOVE = 0x0201, |
|
51 |
||
52 |
/* |
|
53 |
* Initial player info |
|
54 |
* |
|
55 |
* uint32_t x |
|
56 |
* uint32_t y |
|
57 |
*/ |
|
58 |
NETMSG_PLAYER_INFO = 0x0300, |
|
59 |
||
60 |
/* |
|
61 |
* Player position update |
|
62 |
* |
|
63 |
* uint32_t x |
|
64 |
* uint32_t y |
|
65 |
*/ |
|
66 |
NETMSG_PLAYER_POSITION = 0x0301, |
|
5 | 67 |
}; |
68 |
||
69 |
#endif |