10017
|
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 IPCPROTOCOL_H_
|
|
21 |
#define IPCPROTOCOL_H_
|
|
22 |
|
|
23 |
#include "../util/buffer.h"
|
|
24 |
#include "../model/map.h"
|
|
25 |
#include "../model/team.h"
|
|
26 |
#include "../model/scheme.h"
|
|
27 |
#include "../model/gamesetup.h"
|
|
28 |
|
|
29 |
#include <stdbool.h>
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Create a message in the IPC protocol format and add it to
|
|
33 |
* the vector. Use a format string and extra parameters as with printf.
|
|
34 |
*
|
|
35 |
* Returns nonzero if something goes wrong. In that case the buffer
|
|
36 |
* contents are unaffected.
|
|
37 |
*/
|
|
38 |
int flib_ipc_append_message(flib_vector *vec, const char *fmt, ...);
|
|
39 |
|
|
40 |
/**
|
|
41 |
* Append IPC messages to the buffer that configure the engine for
|
|
42 |
* this map.
|
|
43 |
*
|
|
44 |
* Unfortunately the engine needs a slightly different configuration
|
|
45 |
* for generating a map preview.
|
|
46 |
*
|
|
47 |
* Returns nonzero if something goes wrong. In that case the buffer
|
|
48 |
* contents are unaffected.
|
|
49 |
*/
|
|
50 |
int flib_ipc_append_mapconf(flib_vector *vec, const flib_map *map, bool mappreview);
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Append a seed message to the buffer.
|
|
54 |
*
|
|
55 |
* Returns nonzero if something goes wrong. In that case the buffer
|
|
56 |
* contents are unaffected.
|
|
57 |
*/
|
|
58 |
int flib_ipc_append_seed(flib_vector *vec, const char *seed);
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Append a script to the buffer (e.g. "Missions/Training/Basic_Training_-_Bazooka.lua")
|
|
62 |
*
|
|
63 |
* Returns nonzero if something goes wrong. In that case the buffer
|
|
64 |
* contents are unaffected.
|
|
65 |
*/
|
|
66 |
int flib_ipc_append_script(flib_vector *vec, const char *script);
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Append a game style to the buffer. (e.g. "Capture the Flag")
|
|
70 |
*
|
|
71 |
* Returns nonzero if something goes wrong. In that case the buffer
|
|
72 |
* contents are unaffected.
|
|
73 |
*/
|
|
74 |
int flib_ipc_append_style(flib_vector *vec, const char *style);
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Append the game scheme to the buffer.
|
|
78 |
*
|
|
79 |
* Returns nonzero if something goes wrong. In that case the buffer
|
|
80 |
* contents are unaffected.
|
|
81 |
*/
|
|
82 |
int flib_ipc_append_gamescheme(flib_vector *vec, const flib_scheme *scheme);
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Append the entire game config to the buffer (including the final "!" that marks the
|
|
86 |
* end of configuration data for the engine)
|
|
87 |
*
|
|
88 |
* Returns nonzero if something goes wrong. In that case the buffer
|
|
89 |
* contents are unaffected.
|
|
90 |
*/
|
|
91 |
int flib_ipc_append_fullconfig(flib_vector *vec, const flib_gamesetup *setup, bool netgame);
|
|
92 |
|
|
93 |
#endif /* IPCPROTOCOL_H_ */
|