project_files/frontlib/ipc/ipcprotocol.h
author Medo <smaxein@googlemail.com>
Tue, 10 Jul 2012 19:33:57 +0200
changeset 7320 e704706008d4
parent 7314 6171f0bad318
child 7482 d70a5b0d1190
permissions -rw-r--r--
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
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
/**
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7230
diff changeset
    61
 * Append a script message to the buffer.
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
/**
7179
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    69
 * Append the game scheme to the buffer.
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    70
 *
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    71
 * 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
    72
 * contents are unaffected.
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    73
 */
7320
e704706008d4 frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    74
int flib_ipc_append_gamescheme(flib_vector *vec, const flib_scheme *cfg);
7179
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    75
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    76
int flib_ipc_append_addteam(flib_vector *vec, const flib_team *team, bool perHogAmmo, bool noAmmoStore);
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    77
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    78
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
    79
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents:
diff changeset
    80
#endif /* IPCPROTOCOL_H_ */