-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathmessaging.h
63 lines (50 loc) · 1.77 KB
/
messaging.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/******************************************************************************
Curse of War -- Real Time Strategy Game for Linux.
Copyright (C) 2013 Alexey Nikolaev.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifndef _MESSAGING_H
#define _MESSAGING_H
#include <inttypes.h>
#include "common.h"
/* messages from from a client to a server */
#define MSG_C_CONNECT 1
#define MSG_C_BUILD 20
#define MSG_C_FLAG_ON 21
#define MSG_C_FLAG_OFF 22
#define MSG_C_FLAG_OFF_ALL 23
#define MSG_C_FLAG_OFF_HALF 24
#define MSG_C_IS_ALIVE 30
#define MSG_C_PAUSE 40
#define MSG_C_UNPAUSE 41
/* message from a server to a client */
#define MSG_S_CONN_ACCEPTED 5
#define MSG_S_CONN_REJECTED 6
#define MSG_S_STATE 10
struct msg_c_data {
uint8_t i;
uint8_t j;
uint8_t info;
};
struct msg_s_data {
uint8_t control; /* player you control */
uint8_t pause_request;
uint32_t gold [MAX_PLAYER];
uint32_t time;
uint8_t width;
uint8_t height;
uint8_t flag [MAX_WIDTH][MAX_HEIGHT];
uint8_t owner [MAX_WIDTH][MAX_HEIGHT];
uint16_t pop [MAX_WIDTH][MAX_HEIGHT];
uint8_t tile [MAX_WIDTH][MAX_HEIGHT];
};
#endif