-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.h
44 lines (37 loc) · 1012 Bytes
/
types.h
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
#include <cstdio>
#include <cstdlib>
#include <cstring>
#ifndef _TYPE_H
#define _TYPE_H
#define PLAYER_NAME_SIZE 32
#define MAP_NAME_SIZE 64
enum {
MSG_MAPNAME, // Update everyone's mapname
MSG_START, // It's time to start the game!
MSG_PLAYER_UPDATE_INFO, // Update a client's players container.
MSG_CHAT
};
// Common Message Header
typedef struct {
int type;
int size;
} header_t;
// Map message: the map name.
typedef struct {
header_t head;
char value [MAP_NAME_SIZE];
} map_t;
// Player: name, team id, role type, ready - is player ready to start.
typedef struct {
header_t head;
char name[PLAYER_NAME_SIZE];
int team;
int role;
bool ready;
bool more_players;
} player_matchmaking_t;
bool operator == (const player_matchmaking_t& a, const player_matchmaking_t& b);
void error (const char *msg);
int server (int port = 4545);
int recv_complete (int sockfd, void *buf, size_t len, int flags);
#endif