project_files/frontlib/ipc/ipcprotocol.h
author unc0rr
Tue, 08 Oct 2013 10:28:57 +0400
changeset 9501 dc3d658de350
parent 7482 d70a5b0d1190
child 10017 de822cd3df3a
permissions -rw-r--r--
boo, nemo, boo
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
     1
/*
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
     3
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
     4
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
     5
 * This program is free software; you can redistribute it and/or
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
     6
 * modify it under the terms of the GNU General Public License
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
     7
 * as published by the Free Software Foundation; either version 2
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
     8
 * of the License, or (at your option) any later version.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
     9
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    13
 * GNU General Public License for more details.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    14
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    15
 * You should have received a copy of the GNU General Public License
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    16
 * along with this program; if not, write to the Free Software
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    18
 */
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    19
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
#ifndef IPCPROTOCOL_H_
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
#define IPCPROTOCOL_H_
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
7179
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    23
#include "../util/buffer.h"
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    24
#include "../model/map.h"
7179
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    25
#include "../model/team.h"
7320
e704706008d4 frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    26
#include "../model/scheme.h"
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    27
#include "../model/gamesetup.h"
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    28
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    29
#include <stdbool.h>
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    30
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    31
/**
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    32
 * Create a message in the IPC protocol format and add it to
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    33
 * the vector. Use a format string and extra parameters as with printf.
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    34
 *
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    35
 * Returns nonzero if something goes wrong. In that case the buffer
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    36
 * contents are unaffected.
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    37
 */
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    38
int flib_ipc_append_message(flib_vector *vec, const char *fmt, ...);
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    39
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    40
/**
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    41
 * Append IPC messages to the buffer that configure the engine for
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    42
 * this map.
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    43
 *
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    44
 * Unfortunately the engine needs a slightly different configuration
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    45
 * for generating a map preview.
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    46
 *
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    47
 * Returns nonzero if something goes wrong. In that case the buffer
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    48
 * contents are unaffected.
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    49
 */
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    50
int flib_ipc_append_mapconf(flib_vector *vec, const flib_map *map, bool mappreview);
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    51
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    52
/**
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    53
 * Append a seed message to the buffer.
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    54
 *
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    55
 * Returns nonzero if something goes wrong. In that case the buffer
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    56
 * contents are unaffected.
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    57
 */
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    58
int flib_ipc_append_seed(flib_vector *vec, const char *seed);
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    59
7179
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    60
/**
7482
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    61
 * Append a script to the buffer (e.g. "Missions/Training/Basic_Training_-_Bazooka.lua")
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7230
diff changeset
    62
 *
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7230
diff changeset
    63
 * Returns nonzero if something goes wrong. In that case the buffer
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7230
diff changeset
    64
 * contents are unaffected.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7230
diff changeset
    65
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7230
diff changeset
    66
int flib_ipc_append_script(flib_vector *vec, const char *script);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7230
diff changeset
    67
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7230
diff changeset
    68
/**
7482
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    69
 * Append a game style to the buffer. (e.g. "Capture the Flag")
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    70
 *
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    71
 * Returns nonzero if something goes wrong. In that case the buffer
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    72
 * contents are unaffected.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    73
 */
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    74
int flib_ipc_append_style(flib_vector *vec, const char *style);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    75
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    76
/**
7179
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    77
 * Append the game scheme to the buffer.
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    78
 *
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    79
 * Returns nonzero if something goes wrong. In that case the buffer
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    80
 * contents are unaffected.
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    81
 */
7482
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    82
int flib_ipc_append_gamescheme(flib_vector *vec, const flib_scheme *scheme);
7179
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    83
7482
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    84
/**
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    85
 * Append the entire game config to the buffer (including the final "!" that marks the
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    86
 * end of configuration data for the engine)
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    87
 *
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    88
 * Returns nonzero if something goes wrong. In that case the buffer
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    89
 * contents are unaffected.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    90
 */
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    91
int flib_ipc_append_fullconfig(flib_vector *vec, const flib_gamesetup *setup, bool netgame);
7179
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    92
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    93
#endif /* IPCPROTOCOL_H_ */