project_files/frontlib/extra/jnacontrol.c
author Medo <smaxein@googlemail.com>
Sun, 12 Aug 2012 22:37:57 +0200
changeset 7482 d70a5b0d1190
child 7497 7e1d72fc03c7
permissions -rw-r--r--
frontlib improvements: - Added README with overview documentation - Improved code documentation/comments - Added flib_gameconn_send_quit to gracefully exit a running game - Changed the type of some size variables to size_t - Fixed starting a mission/training sending the mission script like a multiplayer script - Removed reference counters from flib_scheme and flib_map - Removed INGAME state from netconn (there is no useful difference to ROOM state) - Added extras/jnacontrol.c to warn when functions signatures used by Hedgeroid change - Other small code improvements
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7482
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     1
/*
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     3
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     4
 *
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     6
 * modify it under the terms of the GNU General Public License
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     7
 * as published by the Free Software Foundation; either version 2
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     8
 * of the License, or (at your option) any later version.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
     9
 *
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    13
 * GNU General Public License for more details.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    14
 *
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    16
 * along with this program; if not, write to the Free Software
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    18
 */
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    19
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
/*
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
 * This file is not directly part of the frontlib and is not required to build it.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
 * However, it is recommended to include it in compilation when building for Android. The purpose of this file
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    23
 * is to ensure consistency between the function signatures of the JNA Java bindings of the Android port and the
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    24
 * frontlib functions.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    25
 *
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    26
 * This file, in essence, consists only of function declarations. They are duplicates of function declarations
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    27
 * from the frontlib headers that are referenced from JNA bindings. If the signature of one of these functions
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    28
 * changes in the frontlib, it will no longer match the signature in this file, and the compiler will show an error.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    29
 * If that happens, you need to update the JNA bindings in Hedgeroid to match the new function signature, and then
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    30
 * update this file.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    31
 *
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    32
 * The reason for all this is that JNA does not actually know the function signatures of the functions it binds,
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    33
 * it derives them from Java method declarations. If those do not match the actual function signatures, you will
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    34
 * only notice when you suddenly get strange (and possibly hard to track down) problems at runtime. This file is
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    35
 * an attempt to detect these problems at compile time instead. Notice that it will NOT detect changes to structs
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    36
 * or constants though, which also require updates to the JNA bindings.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    37
 */
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    38
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    39
/*
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    40
 * Before we include the frontlib headers, we define away the const keyword. This is necessary because there is no
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    41
 * distinction between const and non-const types on the JNA side, and we don't want the compiler to complain because
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    42
 * of bad constness.
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    43
 *
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    44
 * This is so evil, but it works...
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    45
 */
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    46
#define const
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    47
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    48
#include "../frontlib.h"
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    49
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    50
/*
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    51
 * Now we map the Java types to the corresponding C types...
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    52
 */
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    53
typedef flib_netconn *NetconnPtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    54
typedef flib_gameconn *GameconnPtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    55
typedef flib_mapconn *MapconnPtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    56
typedef flib_metascheme *MetaschemePtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    57
typedef flib_room **RoomArrayPtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    58
typedef flib_weaponset *WeaponsetPtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    59
typedef flib_weaponsetlist *WeaponsetListPtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    60
typedef flib_map *MapRecipePtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    61
typedef flib_scheme *SchemePtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    62
typedef flib_schemelist *SchemelistPtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    63
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    64
typedef flib_room *RoomPtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    65
typedef flib_team *TeamPtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    66
typedef flib_gamesetup *GameSetupPtr;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    67
typedef bool boolean;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    68
typedef size_t NativeLong;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    69
typedef void *Pointer;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    70
typedef char *String;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    71
typedef uint8_t *Buffer;
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    72
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    73
/*
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    74
 * Mapping callback types
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    75
 */
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    76
typedef void (*VoidCallback)(Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    77
typedef void (*StrCallback)(Pointer context, String arg1);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    78
typedef void (*IntCallback)(Pointer context, int arg1);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    79
typedef void (*IntStrCallback)(Pointer context, int arg1, String arg2);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    80
typedef void (*StrIntCallback)(Pointer context, String arg1, int arg2);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    81
typedef void (*StrStrCallback)(Pointer context, String arg1, String arg2);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    82
typedef void (*RoomCallback)(Pointer context, RoomPtr arg1);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    83
typedef void (*RoomListCallback)(Pointer context, RoomArrayPtr arg1, int arg2);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    84
typedef void (*StrRoomCallback)(Pointer context, String arg1, RoomPtr arg2);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    85
typedef void (*BoolCallback)(Pointer context, boolean arg1);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    86
typedef void (*StrBoolCallback)(Pointer context, String arg1, boolean arg2);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    87
typedef void (*TeamCallback)(Pointer context, TeamPtr arg1);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    88
typedef void (*BytesCallback)(Pointer context, const uint8_t *buffer, NativeLong size);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    89
typedef void (*BytesBoolCallback)(Pointer context, const uint8_t *buffer, NativeLong size, boolean arg3);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    90
typedef void (*SchemeCallback)(Pointer context, SchemePtr arg1);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    91
typedef void (*MapIntCallback)(Pointer context, MapRecipePtr arg1, int arg2);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    92
typedef void (*WeaponsetCallback)(Pointer context, WeaponsetPtr arg1);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    93
typedef void (*MapimageCallback)(Pointer context, const uint8_t *mapimage, int hogs);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    94
typedef void (*LogCallback)(int arg1, String arg2);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    95
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    96
/*
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    97
 * Below here are the copypasted method declarations from the JNA bindings
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    98
 */
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
    99
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   100
// frontlib.h
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   101
int flib_init();
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   102
void flib_quit();
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   103
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   104
// net/netconn.h
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   105
NetconnPtr flib_netconn_create(String playerName, MetaschemePtr meta, String dataDirPath, String host, int port);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   106
void flib_netconn_destroy(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   107
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   108
void flib_netconn_tick(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   109
boolean flib_netconn_is_chief(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   110
String flib_netconn_get_playername(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   111
GameSetupPtr flib_netconn_create_gamesetup(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   112
int flib_netconn_send_quit(NetconnPtr conn, String quitmsg);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   113
int flib_netconn_send_chat(NetconnPtr conn, String chat);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   114
int flib_netconn_send_teamchat(NetconnPtr conn, String msg);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   115
int flib_netconn_send_password(NetconnPtr conn, String passwd);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   116
int flib_netconn_send_nick(NetconnPtr conn, String nick);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   117
int flib_netconn_send_request_roomlist(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   118
int flib_netconn_send_joinRoom(NetconnPtr conn, String room);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   119
int flib_netconn_send_createRoom(NetconnPtr conn, String room);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   120
int flib_netconn_send_renameRoom(NetconnPtr conn, String roomName);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   121
int flib_netconn_send_leaveRoom(NetconnPtr conn, String msg);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   122
int flib_netconn_send_toggleReady(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   123
int flib_netconn_send_addTeam(NetconnPtr conn, TeamPtr team);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   124
int flib_netconn_send_removeTeam(NetconnPtr conn, String teamname);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   125
int flib_netconn_send_engineMessage(NetconnPtr conn, Buffer message, NativeLong size);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   126
int flib_netconn_send_teamHogCount(NetconnPtr conn, String teamname, int hogcount);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   127
int flib_netconn_send_teamColor(NetconnPtr conn, String teamname, int colorIndex);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   128
int flib_netconn_send_weaponset(NetconnPtr conn, WeaponsetPtr weaponset);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   129
int flib_netconn_send_map(NetconnPtr conn, MapRecipePtr map);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   130
int flib_netconn_send_mapName(NetconnPtr conn, String mapName);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   131
int flib_netconn_send_mapGen(NetconnPtr conn, int mapGen);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   132
int flib_netconn_send_mapTemplate(NetconnPtr conn, int templateFilter);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   133
int flib_netconn_send_mapMazeSize(NetconnPtr conn, int mazeSize);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   134
int flib_netconn_send_mapSeed(NetconnPtr conn, String seed);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   135
int flib_netconn_send_mapTheme(NetconnPtr conn, String theme);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   136
int flib_netconn_send_mapDrawdata(NetconnPtr conn, Buffer drawData, NativeLong size);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   137
int flib_netconn_send_script(NetconnPtr conn, String scriptName);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   138
int flib_netconn_send_scheme(NetconnPtr conn, SchemePtr scheme);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   139
int flib_netconn_send_roundfinished(NetconnPtr conn, boolean withoutError);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   140
int flib_netconn_send_ban(NetconnPtr conn, String playerName);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   141
int flib_netconn_send_kick(NetconnPtr conn, String playerName);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   142
int flib_netconn_send_playerInfo(NetconnPtr conn, String playerName);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   143
int flib_netconn_send_playerFollow(NetconnPtr conn, String playerName);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   144
int flib_netconn_send_startGame(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   145
int flib_netconn_send_toggleRestrictJoins(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   146
int flib_netconn_send_toggleRestrictTeams(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   147
int flib_netconn_send_clearAccountsCache(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   148
int flib_netconn_send_setServerVar(NetconnPtr conn, String name, String value);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   149
int flib_netconn_send_getServerVars(NetconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   150
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   151
void flib_netconn_onMessage(NetconnPtr conn, IntStrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   152
void flib_netconn_onChat(NetconnPtr conn, StrStrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   153
void flib_netconn_onConnected(NetconnPtr conn, VoidCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   154
void flib_netconn_onDisconnected(NetconnPtr conn, IntStrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   155
void flib_netconn_onRoomlist(NetconnPtr conn, RoomListCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   156
void flib_netconn_onRoomAdd(NetconnPtr conn, RoomCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   157
void flib_netconn_onRoomDelete(NetconnPtr conn, StrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   158
void flib_netconn_onRoomUpdate(NetconnPtr conn, StrRoomCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   159
void flib_netconn_onLobbyJoin(NetconnPtr conn, StrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   160
void flib_netconn_onLobbyLeave(NetconnPtr conn, StrStrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   161
void flib_netconn_onNickTaken(NetconnPtr conn, StrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   162
void flib_netconn_onPasswordRequest(NetconnPtr conn, StrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   163
void flib_netconn_onEnterRoom(NetconnPtr conn, BoolCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   164
void flib_netconn_onRoomChiefStatus(NetconnPtr conn, BoolCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   165
void flib_netconn_onReadyState(NetconnPtr conn, StrBoolCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   166
void flib_netconn_onLeaveRoom(NetconnPtr conn, IntStrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   167
void flib_netconn_onTeamAdd(NetconnPtr conn, TeamCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   168
void flib_netconn_onTeamDelete(NetconnPtr conn, StrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   169
void flib_netconn_onRoomJoin(NetconnPtr conn, StrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   170
void flib_netconn_onRoomLeave(NetconnPtr conn, StrStrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   171
void flib_netconn_onRunGame(NetconnPtr conn, VoidCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   172
void flib_netconn_onTeamAccepted(NetconnPtr conn, StrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   173
void flib_netconn_onHogCountChanged(NetconnPtr conn, StrIntCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   174
void flib_netconn_onTeamColorChanged(NetconnPtr conn, StrIntCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   175
void flib_netconn_onEngineMessage(NetconnPtr conn, BytesCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   176
void flib_netconn_onCfgScheme(NetconnPtr conn, SchemeCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   177
void flib_netconn_onMapChanged(NetconnPtr conn, MapIntCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   178
void flib_netconn_onScriptChanged(NetconnPtr conn, StrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   179
void flib_netconn_onWeaponsetChanged(NetconnPtr conn, WeaponsetCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   180
void flib_netconn_onAdminAccess(NetconnPtr conn, VoidCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   181
void flib_netconn_onServerVar(NetconnPtr conn, StrStrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   182
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   183
// ipc/gameconn.h
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   184
GameconnPtr flib_gameconn_create(String playerName, GameSetupPtr setup, boolean netgame);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   185
GameconnPtr flib_gameconn_create_playdemo(Buffer demo, NativeLong size);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   186
GameconnPtr flib_gameconn_create_loadgame(String playerName, Buffer save, NativeLong size);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   187
GameconnPtr flib_gameconn_create_campaign(String playerName, String seed, String script);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   188
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   189
void flib_gameconn_destroy(GameconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   190
int flib_gameconn_getport(GameconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   191
void flib_gameconn_tick(GameconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   192
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   193
int flib_gameconn_send_enginemsg(GameconnPtr conn, Buffer data, NativeLong len);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   194
int flib_gameconn_send_textmsg(GameconnPtr conn, int msgtype, String msg);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   195
int flib_gameconn_send_chatmsg(GameconnPtr conn, String playername, String msg);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   196
int flib_gameconn_send_quit(GameconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   197
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   198
void flib_gameconn_onConnect(GameconnPtr conn, VoidCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   199
void flib_gameconn_onDisconnect(GameconnPtr conn, IntCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   200
void flib_gameconn_onErrorMessage(GameconnPtr conn, StrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   201
void flib_gameconn_onChat(GameconnPtr conn, StrBoolCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   202
void flib_gameconn_onGameRecorded(GameconnPtr conn, BytesBoolCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   203
void flib_gameconn_onEngineMessage(GameconnPtr conn, BytesCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   204
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   205
// ipc/mapconn.h
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   206
MapconnPtr flib_mapconn_create(MapRecipePtr mapdesc);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   207
void flib_mapconn_destroy(MapconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   208
int flib_mapconn_getport(MapconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   209
void flib_mapconn_onSuccess(MapconnPtr conn, MapimageCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   210
void flib_mapconn_onFailure(MapconnPtr conn, StrCallback callback, Pointer context);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   211
void flib_mapconn_tick(MapconnPtr conn);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   212
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   213
// model/scheme.h
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   214
MetaschemePtr flib_metascheme_from_ini(String filename);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   215
MetaschemePtr flib_metascheme_retain(MetaschemePtr metainfo);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   216
void flib_metascheme_release(MetaschemePtr metainfo);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   217
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   218
// model/schemelist.h
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   219
SchemelistPtr flib_schemelist_from_ini(MetaschemePtr meta, String filename);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   220
int flib_schemelist_to_ini(String filename, SchemelistPtr list);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   221
void flib_schemelist_destroy(SchemelistPtr list);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   222
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   223
// model/team.h
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   224
TeamPtr flib_team_from_ini(String filename);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   225
int flib_team_to_ini(String filename, TeamPtr team);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   226
void flib_team_destroy(TeamPtr team);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   227
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   228
// model/weapon.h
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   229
WeaponsetListPtr flib_weaponsetlist_from_ini(String filename);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   230
int flib_weaponsetlist_to_ini(String filename, WeaponsetListPtr weaponsets);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   231
void flib_weaponsetlist_destroy(WeaponsetListPtr list);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   232
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   233
// util/logging.h
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   234
void flib_log_setLevel(int level);
d70a5b0d1190 frontlib improvements:
Medo <smaxein@googlemail.com>
parents:
diff changeset
   235
void flib_log_setCallback(LogCallback callback);