1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#ifndef CONTENT_H
#define CONTENT_H
typedef enum {
N_VALLEY_FLOWER,
N_MOUNTAIN_FLOWER,
N_BIG_TREE,
N_NEEDLE_TREE,
N_ROCK,
N_WATER,
N_PLANK,
N_PATH,
} node_type;
typedef struct {
uint8_t r, g, b;
} color;
typedef struct {
bool present;
node_type type;
int8_t z; // for rocks, indicates rock level
color col;
} node;
typedef enum {
MOVE_UP,
MOVE_DOWN,
MOVE_LEFT,
MOVE_RIGHT,
} move_dir;
typedef enum {
CPKT_HI, // len motd
CPKT_PLAYERS, // len
CPKT_MOVE, // player_id remove x y z
CPKT_NODES, // z x y w h [node]
} client_pkt;
typedef enum {
SPKT_HI, // len name len password
SPKT_MOVE, // move_dir
} server_pkt;
#endif
|