project_files/frontlib/ipc/ipcprotocol.h
author Wuzzy <Wuzzy2@mail.ru>
Fri, 30 Mar 2018 15:56:47 +0200
changeset 13301 1c8c270aebed
parent 10017 de822cd3df3a
permissions -rw-r--r--
Travis: Drop zoogie PPA, drop ImageMagick from apt-get line
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
     1
/*
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
     2
 * Hedgewars, a free turn based strategy game
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
     3
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
     4
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
     5
 * This program is free software; you can redistribute it and/or
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
     6
 * modify it under the terms of the GNU General Public License
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
     7
 * as published by the Free Software Foundation; either version 2
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
     8
 * of the License, or (at your option) any later version.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
     9
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    13
 * GNU General Public License for more details.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    14
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    15
 * You should have received a copy of the GNU General Public License
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    16
 * along with this program; if not, write to the Free Software
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    18
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    19
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    20
#ifndef IPCPROTOCOL_H_
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    21
#define IPCPROTOCOL_H_
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    22
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    23
#include "../util/buffer.h"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    24
#include "../model/map.h"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    25
#include "../model/team.h"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    26
#include "../model/scheme.h"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    27
#include "../model/gamesetup.h"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    28
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    29
#include <stdbool.h>
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    30
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    31
/**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    32
 * Create a message in the IPC protocol format and add it to
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    33
 * the vector. Use a format string and extra parameters as with printf.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    34
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    35
 * Returns nonzero if something goes wrong. In that case the buffer
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    36
 * contents are unaffected.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    37
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    38
int flib_ipc_append_message(flib_vector *vec, const char *fmt, ...);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    39
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    40
/**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    41
 * Append IPC messages to the buffer that configure the engine for
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    42
 * this map.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    43
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    44
 * Unfortunately the engine needs a slightly different configuration
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    45
 * for generating a map preview.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    46
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    47
 * Returns nonzero if something goes wrong. In that case the buffer
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    48
 * contents are unaffected.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    49
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    50
int flib_ipc_append_mapconf(flib_vector *vec, const flib_map *map, bool mappreview);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    51
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    52
/**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    53
 * Append a seed message to the buffer.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    54
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    55
 * Returns nonzero if something goes wrong. In that case the buffer
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    56
 * contents are unaffected.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    57
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    58
int flib_ipc_append_seed(flib_vector *vec, const char *seed);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    59
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    60
/**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    61
 * Append a script to the buffer (e.g. "Missions/Training/Basic_Training_-_Bazooka.lua")
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    62
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    63
 * Returns nonzero if something goes wrong. In that case the buffer
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    64
 * contents are unaffected.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    65
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    66
int flib_ipc_append_script(flib_vector *vec, const char *script);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    67
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    68
/**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    69
 * Append a game style to the buffer. (e.g. "Capture the Flag")
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    70
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    71
 * Returns nonzero if something goes wrong. In that case the buffer
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    72
 * contents are unaffected.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    73
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    74
int flib_ipc_append_style(flib_vector *vec, const char *style);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    75
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    76
/**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    77
 * Append the game scheme to the buffer.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    78
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    79
 * Returns nonzero if something goes wrong. In that case the buffer
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    80
 * contents are unaffected.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    81
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    82
int flib_ipc_append_gamescheme(flib_vector *vec, const flib_scheme *scheme);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    83
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    84
/**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    85
 * Append the entire game config to the buffer (including the final "!" that marks the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    86
 * end of configuration data for the engine)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    87
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    88
 * Returns nonzero if something goes wrong. In that case the buffer
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    89
 * contents are unaffected.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    90
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    91
int flib_ipc_append_fullconfig(flib_vector *vec, const flib_gamesetup *setup, bool netgame);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    92
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 7482
diff changeset
    93
#endif /* IPCPROTOCOL_H_ */