|
1 /* |
|
2 * Hedgewars, a free turn based strategy game |
|
3 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com> |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or |
|
6 * modify it under the terms of the GNU General Public License |
|
7 * as published by the Free Software Foundation; either version 2 |
|
8 * of the License, or (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License |
|
16 * along with this program; if not, write to the Free Software |
|
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
18 */ |
|
19 |
|
20 #ifndef NETPROTOCOL_H_ |
|
21 #define NETPROTOCOL_H_ |
|
22 |
|
23 #include "../model/team.h" |
|
24 #include "../model/scheme.h" |
|
25 #include "../model/map.h" |
|
26 #include "../model/room.h" |
|
27 |
|
28 #include <stddef.h> |
|
29 |
|
30 /** |
|
31 * Create a new team from this 23-part net message |
|
32 */ |
|
33 flib_team *flib_team_from_netmsg(char **parts); |
|
34 |
|
35 /** |
|
36 * Create a new scheme from this net message, which must have |
|
37 * meta->modCount+meta->settingCount+1 parts. |
|
38 */ |
|
39 flib_scheme *flib_scheme_from_netmsg(char **parts); |
|
40 |
|
41 /** |
|
42 * Create a new map from this five-part netmsg |
|
43 */ |
|
44 flib_map *flib_map_from_netmsg(char **parts); |
|
45 |
|
46 /** |
|
47 * Decode the drawn map data from this netmessage line. |
|
48 * |
|
49 * The data is first base64 decoded and then quncompress()ed. |
|
50 * The return value is a newly allocated byte buffer, the length |
|
51 * is written to the variable pointed to by outlen. |
|
52 * Returns NULL on error. |
|
53 */ |
|
54 int flib_drawnmapdata_from_netmsg(char *netmsg, uint8_t **outbuf, size_t *outlen); |
|
55 |
|
56 /** |
|
57 * Create a new room from this 8-part net message |
|
58 */ |
|
59 flib_room *flib_room_from_netmsg(char **params); |
|
60 |
|
61 /** |
|
62 * Create an array of count rooms from count*8 netmessage parts |
|
63 */ |
|
64 flib_room **flib_room_array_from_netmsg(char **params, int count); |
|
65 |
|
66 #endif /* NETPROTOCOL_H_ */ |