blob: 94a65b78cd22d33eae53d9bbc55d419dd0eb75c6 (
plain) (
blame)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
enum class PacketType
{
packet_connect,
packet_disconnect,
packet_move,
packet_ping,
packet_server_info
};
struct Player
{
unsigned int sender_id;
int fd;
char name[20];
char ip[20];
int x, y;
int color;
bool is_color;
};
struct PacketConnect
{
Player player;
};
struct PacketDisconnect
{
Player player;
};
struct PacketMove
{
Player player;
int x, y;
bool is_color;
};
struct PacketPing
{
};
struct PacketServerInfo
{
int max_players;
int fps;
};
struct Packet
{
PacketType type;
unsigned int sender_id;
union
{
PacketConnect packet_connect;
PacketDisconnect packet_disconnect;
PacketMove packet_move;
PacketPing packet_ping;
PacketServerInfo packet_server_info;
} data;
};
|