author | Medo <smaxein@googlemail.com> |
Sun, 16 Sep 2012 17:42:48 +0200 | |
changeset 7689 | 855eeee4166f |
parent 7580 | c92596feac0d |
child 7691 | 55c0a856ecd0 |
permissions | -rw-r--r-- |
7314
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
1 |
/* |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
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:
7275
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:
7275
diff
changeset
|
4 |
* |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
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:
7275
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:
7275
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:
7275
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:
7275
diff
changeset
|
9 |
* |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
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:
7275
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:
7275
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:
7275
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:
7275
diff
changeset
|
14 |
* |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
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:
7275
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:
7275
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:
7275
diff
changeset
|
18 |
*/ |
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
19 |
|
7482 | 20 |
/** |
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
21 |
* This file contains functions for communicating with a Hedgewars server to chat, prepare and play |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
22 |
* rounds of Hedgewars. |
7482 | 23 |
* |
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
24 |
* To use this, first create a netconn object by calling flib_netconn_create. This will start the |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
25 |
* connection to the game server (which might fail right away, the function returns null then). You |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
26 |
* should also register your callback functions right at the start to ensure you don't miss any |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
27 |
* callbacks. |
7482 | 28 |
* |
29 |
* In order to allow the netconn to run, you should regularly call flib_netconn_tick(), which |
|
30 |
* performs network I/O and calls your callbacks on interesting events. |
|
31 |
* |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
32 |
* When the connection is closed, you will receive the onDisconnect callback. This is the signal to |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
33 |
* destroy the netconn and stop calling tick(). |
7482 | 34 |
* |
35 |
* The connection process lasts from the time you create the netconn until you receive the |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
36 |
* onConnected callback (or onDisconnected in case something goes wrong). During that time, you |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
37 |
* might receive the onNickTaken and onPasswordRequest callbacks; see their description for more |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
38 |
* information on how to handle them. You could also receive other callbacks during connecting (e.g. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
39 |
* about the room list), but it should be safe to ignore them. |
7482 | 40 |
* |
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
41 |
* Once you are connected, you are in the lobby, and you can enter rooms and leave them again. The |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
42 |
* room and lobby states have different protocols, so many commands only work in either one or the |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
43 |
* other. If you are in a room you might also be in a game, but most of the functions behave the |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
44 |
* same ingame as in a room. |
7482 | 45 |
* |
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
46 |
* The state changes from lobby to room when the server tells you that you just entered one, which |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
47 |
* will also trigger the onEnterRoom callback. This usually happens in reply to either a joinRoom, |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
48 |
* createRoom or playerFollow command. |
7482 | 49 |
* |
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
50 |
* The state changes back to lobby when the room is dissolved, when you are kicked from the room, or |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
51 |
* when you actively leave the room using flib_netconn_send_leaveRoom. The first two events will |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
52 |
* trigger the onLeaveRoom callback. |
7482 | 53 |
*/ |
54 |
||
7234
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
55 |
#ifndef NETCONN_H_ |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
56 |
#define NETCONN_H_ |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
57 |
|
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
58 |
#include "../model/gamesetup.h" |
7320
e704706008d4
frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents:
7316
diff
changeset
|
59 |
#include "../model/scheme.h" |
7338 | 60 |
#include "../model/room.h" |
7234
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
61 |
|
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
62 |
#include <stddef.h> |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
63 |
#include <stdint.h> |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
64 |
#include <stdbool.h> |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
65 |
|
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
66 |
#define NETCONN_STATE_CONNECTING 0 |
7234
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
67 |
#define NETCONN_STATE_LOBBY 1 |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
68 |
#define NETCONN_STATE_ROOM 2 |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
69 |
#define NETCONN_STATE_DISCONNECTED 10 |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
70 |
|
7482 | 71 |
#define NETCONN_DISCONNECT_NORMAL 0 // The connection was closed normally |
72 |
#define NETCONN_DISCONNECT_SERVER_TOO_OLD 1 // The server has a lower protocol version than we do |
|
73 |
#define NETCONN_DISCONNECT_AUTH_FAILED 2 // You sent a password with flib_netconn_send_password that was not accepted |
|
74 |
#define NETCONN_DISCONNECT_CONNLOST 3 // The network connection was lost |
|
75 |
#define NETCONN_DISCONNECT_INTERNAL_ERROR 100 // Something went wrong in frontlib itself |
|
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
76 |
|
7482 | 77 |
#define NETCONN_ROOMLEAVE_ABANDONED 0 // The room was closed because the chief left |
78 |
#define NETCONN_ROOMLEAVE_KICKED 1 // You have been kicked from the room |
|
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
79 |
|
7482 | 80 |
#define NETCONN_MSG_TYPE_PLAYERINFO 0 // A response to flib_netconn_send_playerInfo |
81 |
#define NETCONN_MSG_TYPE_SERVERMESSAGE 1 // The welcome message when connecting to the lobby |
|
82 |
#define NETCONN_MSG_TYPE_WARNING 2 // A general warning message |
|
83 |
#define NETCONN_MSG_TYPE_ERROR 3 // A general error message |
|
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
84 |
|
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
85 |
#define NETCONN_MAPCHANGE_FULL 0 |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
86 |
#define NETCONN_MAPCHANGE_MAP 1 |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
87 |
#define NETCONN_MAPCHANGE_MAPGEN 2 |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
88 |
#define NETCONN_MAPCHANGE_DRAWNMAP 3 |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
89 |
#define NETCONN_MAPCHANGE_MAZE_SIZE 4 |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
90 |
#define NETCONN_MAPCHANGE_TEMPLATE 5 |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
91 |
#define NETCONN_MAPCHANGE_THEME 6 |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
92 |
#define NETCONN_MAPCHANGE_SEED 7 |
7234
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
93 |
|
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
94 |
typedef struct _flib_netconn flib_netconn; |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
95 |
|
7275
15f722e0b96f
frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents:
7271
diff
changeset
|
96 |
/** |
15f722e0b96f
frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents:
7271
diff
changeset
|
97 |
* Create a new netplay connection with these parameters. |
15f722e0b96f
frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents:
7271
diff
changeset
|
98 |
* The path to the data directory must end with a path delimiter (e.g. C:\Games\Hedgewars\Data\) |
15f722e0b96f
frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents:
7271
diff
changeset
|
99 |
*/ |
7497 | 100 |
flib_netconn *flib_netconn_create(const char *playerName, const char *dataDirPath, const char *host, int port); |
7234
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
101 |
void flib_netconn_destroy(flib_netconn *conn); |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
102 |
|
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
103 |
/** |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
104 |
* Perform I/O operations and call callbacks if something interesting happens. |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
105 |
* Should be called regularly. |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
106 |
*/ |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
107 |
void flib_netconn_tick(flib_netconn *conn); |
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
108 |
|
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
109 |
/** |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
110 |
* Are you currently the owner of this room? The return value only makes sense in |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
111 |
* NETCONN_STATE_ROOM and NETCONN_STATE_INGAME states. |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
112 |
*/ |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
113 |
bool flib_netconn_is_chief(flib_netconn *conn); |
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
114 |
|
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
115 |
/** |
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
116 |
* Returns the playername. This is *probably* the one provided on creation, but if that name was |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
117 |
* already taken, a different one could have been set by the onNickTaken callback or its default |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
118 |
* implementation. |
7338 | 119 |
*/ |
120 |
const char *flib_netconn_get_playername(flib_netconn *conn); |
|
121 |
||
122 |
/** |
|
7275
15f722e0b96f
frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents:
7271
diff
changeset
|
123 |
* Generate a game setup from the current room state. |
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
124 |
* Returns NULL if the room state does not contain enough information for a complete game setup, |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
125 |
* or if an error occurs. |
7275
15f722e0b96f
frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents:
7271
diff
changeset
|
126 |
* |
7314
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
127 |
* The new gamesetup must be destroyed with flib_gamesetup_destroy(). |
7275
15f722e0b96f
frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents:
7271
diff
changeset
|
128 |
*/ |
7314
6171f0bad318
frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents:
7275
diff
changeset
|
129 |
flib_gamesetup *flib_netconn_create_gamesetup(flib_netconn *conn); |
7275
15f722e0b96f
frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents:
7271
diff
changeset
|
130 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
131 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
132 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
133 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
134 |
// Send functions needed when connecting and disconnecting |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
135 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
136 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
137 |
* Request a different nickname. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
138 |
* This function only makes sense in reaction to an onNickTaken callback, because the netconn |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
139 |
* automatically requests the nickname you provide on creation, and once the server accepts the |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
140 |
* nickname it can no longer be changed. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
141 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
142 |
int flib_netconn_send_nick(flib_netconn *conn, const char *nick); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
143 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
144 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
145 |
* Send the password in reply to a password request. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
146 |
* If the server does not accept the password, you will be disconnected |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
147 |
* (NETCONN_DISCONNECT_AUTH_FAILED) |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
148 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
149 |
int flib_netconn_send_password(flib_netconn *conn, const char *passwd); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
150 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
151 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
152 |
* Tell the server that you want to leave. If successful, the server will disconnect you. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
153 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
154 |
int flib_netconn_send_quit(flib_netconn *conn, const char *quitmsg); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
155 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
156 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
157 |
// Send functions that make sense both in the lobby and in rooms |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
158 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
159 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
160 |
* Send a chat message. This message is either sent to the lobby or the room, depending on |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
161 |
* whether you are in a room at the moment. The message is not echoed back to you. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
162 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
163 |
int flib_netconn_send_chat(flib_netconn *conn, const char *chat); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
164 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
165 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
166 |
* Kick a player. This has different meanings in the lobby and in a room; |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
167 |
* In the lobby, it will kick the player from the server, and you need to be a server admin to |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
168 |
* do it. In a room, it will kick the player from the room, and you need to be room chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
169 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
170 |
int flib_netconn_send_kick(flib_netconn *conn, const char *playerName); |
7338 | 171 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
172 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
173 |
* Request information about a player (e.g. current room, version, partial IP). If the action |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
174 |
* succeeds, you will receive an onMessage callback with NETCONN_MSG_TYPE_PLAYERINFO containing |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
175 |
* the requested information. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
176 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
177 |
int flib_netconn_send_playerInfo(flib_netconn *conn, const char *playerName); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
178 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
179 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
180 |
// Send functions that only make sense in the lobby |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
181 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
182 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
183 |
* Request an update of the room list. Only makes sense when in lobby state. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
184 |
* If the action succeeds, you will receive an onRoomlist callback containing the current room |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
185 |
* data. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
186 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
187 |
int flib_netconn_send_request_roomlist(flib_netconn *conn); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
188 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
189 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
190 |
* Join a room as guest (not chief). Only makes sense when in lobby state. If the action |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
191 |
* succeeds, you will receive an onEnterRoom callback with chief=false. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
192 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
193 |
int flib_netconn_send_joinRoom(flib_netconn *conn, const char *room); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
194 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
195 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
196 |
* Follow a player. Only valid in the lobby. If the player is in a room (or in a game), this |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
197 |
* command is analogous to calling flib_netconn_send_joinRoom with that room. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
198 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
199 |
int flib_netconn_send_playerFollow(flib_netconn *conn, const char *playerName); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
200 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
201 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
202 |
* Create and join a new room. Only makes sense when in lobby state. If the action succeeds, |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
203 |
* you will receive an onEnterRoom callback with chief=true. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
204 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
205 |
int flib_netconn_send_createRoom(flib_netconn *conn, const char *room); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
206 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
207 |
/** |
7689
855eeee4166f
frontlib: Add/change comments to correspond to recent changes in QtFrontend and server
Medo <smaxein@googlemail.com>
parents:
7580
diff
changeset
|
208 |
* Ban a player. The scope of this ban depends on whether you are in a room or in the lobby. |
855eeee4166f
frontlib: Add/change comments to correspond to recent changes in QtFrontend and server
Medo <smaxein@googlemail.com>
parents:
7580
diff
changeset
|
209 |
* In a room, you need to be the room chief, and the ban will apply to the room only. In the |
855eeee4166f
frontlib: Add/change comments to correspond to recent changes in QtFrontend and server
Medo <smaxein@googlemail.com>
parents:
7580
diff
changeset
|
210 |
* lobby, you need to be server admin to ban someone, and the ban applies to the entire server. |
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
211 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
212 |
int flib_netconn_send_ban(flib_netconn *conn, const char *playerName); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
213 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
214 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
215 |
* Does something administrator-y. At any rate you need to be an administrator and in the lobby |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
216 |
* to use this command. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
217 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
218 |
int flib_netconn_send_clearAccountsCache(flib_netconn *conn); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
219 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
220 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
221 |
* Sets a server variable to the indicated value. Only makes sense if you are server admin and |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
222 |
* in the lobby. Known variables are MOTD_NEW, MOTD_OLD and LATEST_PROTO. MOTD_OLD is shown to |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
223 |
* players with older protocol versions, to inform them that they might want to update. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
224 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
225 |
int flib_netconn_send_setServerVar(flib_netconn *conn, const char *name, const char *value); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
226 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
227 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
228 |
* Queries all server variables. Only makes sense if you are server admin and in the lobby. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
229 |
* If the action succeeds, you will receive several onServerVar callbacks with the |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
230 |
* current values of all server variables. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
231 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
232 |
int flib_netconn_send_getServerVars(flib_netconn *conn); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
233 |
|
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
234 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
235 |
// Send functions that only make sense in a room |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
236 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
237 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
238 |
* Leave the room for the lobby. Only makes sense in room state. msg can be NULL if you don't |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
239 |
* want to send a message. The server always accepts a part message, so once you send it off, |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
240 |
* you can just assume that you are back in the lobby. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
241 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
242 |
int flib_netconn_send_leaveRoom(flib_netconn *conn, const char *msg); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
243 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
244 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
245 |
* Change your "ready" status in the room. Only makes sense when in room state. If the action |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
246 |
* succeeds, you will receive an onReadyState callback containing the change. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
247 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
248 |
int flib_netconn_send_toggleReady(flib_netconn *conn); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
249 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
250 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
251 |
* Add a team to the current room. Apart from the "fixed" team information, this also includes |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
252 |
* the color, but not the number of hogs. Only makes sense when in room state. If the action |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
253 |
* succeeds, you will receive an onTeamAccepted callback with the name of the team. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
254 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
255 |
* Notes: Technically, sending a color here is the only way for a non-chief to set the color of |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
256 |
* her own team. The server remembers this color and even generates a separate teamColor message |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
257 |
* to inform everyone of it. However, at the moment the frontends generally override this color |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
258 |
* with one they choose themselves in order to deal with unfortunate behavior of the QtFrontend, |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
259 |
* which always sends color index 0 when adding a team but thinks that the team has a random |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
260 |
* color. The chief always sends a new color in order to bring the QtFrontend back into sync. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
261 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
262 |
int flib_netconn_send_addTeam(flib_netconn *conn, const flib_team *team); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
263 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
264 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
265 |
* Remove the team with the name teamname. Only makes sense when in room state. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
266 |
* The server does not send a reply on success. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
267 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
268 |
int flib_netconn_send_removeTeam(flib_netconn *conn, const char *teamname); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
269 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
270 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
271 |
// Send functions that only make sense in a room and if you are room chief |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
272 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
273 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
274 |
* Rename the current room. Only makes sense in room state and if you are chief. If the action |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
275 |
* succeeds, you (and everyone else on the server) will receive an onRoomUpdate message |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
276 |
* containing the change. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
277 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
278 |
int flib_netconn_send_renameRoom(flib_netconn *conn, const char *roomName); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
279 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
280 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
281 |
* Set the number of hogs for a team. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
282 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
283 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
284 |
int flib_netconn_send_teamHogCount(flib_netconn *conn, const char *teamname, int hogcount); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
285 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
286 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
287 |
* Set the teamcolor of a team. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
288 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
289 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
290 |
int flib_netconn_send_teamColor(flib_netconn *conn, const char *teamname, int colorIndex); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
291 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
292 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
293 |
* Set the weaponset for the room. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
294 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
295 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
296 |
int flib_netconn_send_weaponset(flib_netconn *conn, const flib_weaponset *weaponset); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
297 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
298 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
299 |
* Set the map for the room. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
300 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
301 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
302 |
int flib_netconn_send_map(flib_netconn *conn, const flib_map *map); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
303 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
304 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
305 |
* Set the mapname. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
306 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
307 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
308 |
int flib_netconn_send_mapName(flib_netconn *conn, const char *mapName); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
309 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
310 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
311 |
* Set the map generator (regular, maze, drawn, named). Only makes sense in room state and if |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
312 |
* you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
313 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
314 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
315 |
int flib_netconn_send_mapGen(flib_netconn *conn, int mapGen); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
316 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
317 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
318 |
* Set the map template for regular maps. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
319 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
320 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
321 |
int flib_netconn_send_mapTemplate(flib_netconn *conn, int templateFilter); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
322 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
323 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
324 |
* Set the maze template (maze size) for mazes. Only makes sense in room state and if you are |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
325 |
* chief. The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
326 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
327 |
int flib_netconn_send_mapMazeSize(flib_netconn *conn, int mazeSize); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
328 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
329 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
330 |
* Set the seed for the map. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
331 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
332 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
333 |
int flib_netconn_send_mapSeed(flib_netconn *conn, const char *seed); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
334 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
335 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
336 |
* Set the theme for the map. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
337 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
338 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
339 |
int flib_netconn_send_mapTheme(flib_netconn *conn, const char *theme); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
340 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
341 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
342 |
* Set the draw data for the drawn map. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
343 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
344 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
345 |
int flib_netconn_send_mapDrawdata(flib_netconn *conn, const uint8_t *drawData, size_t size); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
346 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
347 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
348 |
* Set the script (game style). Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
349 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
350 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
351 |
int flib_netconn_send_script(flib_netconn *conn, const char *scriptName); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
352 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
353 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
354 |
* Set the scheme. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
355 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
356 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
357 |
int flib_netconn_send_scheme(flib_netconn *conn, const flib_scheme *scheme); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
358 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
359 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
360 |
* Signal that you want to start the game. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
361 |
* The server will check whether all players are ready and whether it believes the setup makes |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
362 |
* sense (e.g. more than one clan). If the server is satisfied, you will receive an onRunGame |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
363 |
* callback (all other clients in the room are notified the same way). Otherwise the server |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
364 |
* might answer with a warning, or might not answer at all. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
365 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
366 |
int flib_netconn_send_startGame(flib_netconn *conn); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
367 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
368 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
369 |
* Allow/forbid players to join the room. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
370 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
371 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
372 |
int flib_netconn_send_toggleRestrictJoins(flib_netconn *conn); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
373 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
374 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
375 |
* Allow/forbid adding teams to the room. Only makes sense in room state and if you are chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
376 |
* The server does not send a reply. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
377 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
378 |
int flib_netconn_send_toggleRestrictTeams(flib_netconn *conn); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
379 |
|
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
380 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
381 |
// Send functions that are only needed for running a game |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
382 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
383 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
384 |
* Send a teamchat message, forwarded from the engine. Only makes sense ingame. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
385 |
* The server does not send a reply. In contrast to a Chat message, the server |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
386 |
* automatically converts this into an engine message and passes it on to the other |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
387 |
* clients. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
388 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
389 |
int flib_netconn_send_teamchat(flib_netconn *conn, const char *msg); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
390 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
391 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
392 |
* Send an engine message. Only makes sense when ingame. In a networked game, you have to pass |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
393 |
* all the engine messages from the engine here, and they will be spread to all other clients |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
394 |
* in the game to keep the game in sync. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
395 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
396 |
int flib_netconn_send_engineMessage(flib_netconn *conn, const uint8_t *message, size_t size); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
397 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
398 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
399 |
* Inform the server that the round has ended. Call this when the engine has disconnected, |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
400 |
* passing 1 if the round ended normally, 0 otherwise. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
401 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
402 |
int flib_netconn_send_roundfinished(flib_netconn *conn, bool withoutError); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
403 |
|
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
404 |
|
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
405 |
|
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
406 |
|
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
407 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
408 |
// Callbacks that are important for connecting/disconnecting |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
409 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
410 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
411 |
* onNickTaken is called when connecting to the server, if it turns out that there is already a |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
412 |
* player with the same nick. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
413 |
* In order to proceed, a new nickname needs to be sent to the server using |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
414 |
* flib_netconn_send_nick() (or of course you can bail out and send a QUIT). |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
415 |
* If you don't set a callback, the netconn will automatically react by generating a new name. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
416 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
417 |
void flib_netconn_onNickTaken(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
418 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
419 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
420 |
* When connecting with a registered nickname, the server will ask for a password before |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
421 |
* admitting you in. This callback is called when that happens. As a reaction, you can send the |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
422 |
* password using flib_netconn_send_password. If you don't register a callback, the default |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
423 |
* behavior is to just quit in a way that will cause a disconnect with |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
424 |
* NETCONN_DISCONNECT_AUTH_FAILED. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
425 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
426 |
* You can't just choose a new nickname when you receive this callback, because at that point |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
427 |
* the server has already accepted your nick. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
428 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
429 |
void flib_netconn_onPasswordRequest(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
430 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
431 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
432 |
* This is called when the server has accepted our nickname (and possibly password) and we have |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
433 |
* entered the lobby. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
434 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
435 |
void flib_netconn_onConnected(flib_netconn *conn, void (*callback)(void *context), void* context); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
436 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
437 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
438 |
* This is always the last callback (unless the netconn is destroyed early), and the netconn |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
439 |
* should be destroyed when it is received. The reason for the disconnect is passed as one of |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
440 |
* the NETCONN_DISCONNECT_ constants. Sometimes a message is included as well, but that |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
441 |
* parameter might also be NULL. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
442 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
443 |
void flib_netconn_onDisconnected(flib_netconn *conn, void (*callback)(void *context, int reason, const char *message), void* context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
444 |
|
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
445 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
446 |
// Callbacks that make sense in most situations |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
447 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
448 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
449 |
* Callback for several informational messages that should be displayed to the user |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
450 |
* (e.g. in the chat window), but do not require a reaction. If a game is running, you might |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
451 |
* want to redirect some of these messages to the engine as well so the user will see them. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
452 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
453 |
void flib_netconn_onMessage(flib_netconn *conn, void (*callback)(void *context, int msgtype, const char *msg), void* context); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
454 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
455 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
456 |
* We received a chat message. Where this message belongs depends on the current state |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
457 |
* (lobby/room). If a game is running the message should be passed to the engine. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
458 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
459 |
void flib_netconn_onChat(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *msg), void* context); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
460 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
461 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
462 |
* Callbacks for incremental room list updates. They will fire whenever these events occur, |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
463 |
* even before you first query the actual roomlist - so be sure not to blindly reference your |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
464 |
* room list in these callbacks. The server currently only sends updates when a room changes |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
465 |
* its name, so in order to update other room information you need to query the roomlist again |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
466 |
* (see send_request_roomlist / onRoomlist). |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
467 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
468 |
void flib_netconn_onRoomAdd(flib_netconn *conn, void (*callback)(void *context, const flib_room *room), void* context); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
469 |
void flib_netconn_onRoomDelete(flib_netconn *conn, void (*callback)(void *context, const char *name), void* context); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
470 |
void flib_netconn_onRoomUpdate(flib_netconn *conn, void (*callback)(void *context, const char *oldName, const flib_room *room), void* context); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
471 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
472 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
473 |
* Callbacks for players joining or leaving the lobby. In contrast to the roomlist updates, you |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
474 |
* will get a JOIN callback for every player already on the server when you join (and there is |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
475 |
* no direct way to query the current playerlist) |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
476 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
477 |
* NOTE: partMessage may be NULL. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
478 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
479 |
void flib_netconn_onLobbyJoin(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
480 |
void flib_netconn_onLobbyLeave(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *partMessage), void* context); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
481 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
482 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
483 |
// Callbacks that happen only in response to specific requests |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
484 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
485 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
486 |
* Response to flib_netconn_send_request_roomlist(). |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
487 |
* The rooms array contains the current state of all rooms on the server. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
488 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
489 |
void flib_netconn_onRoomlist(flib_netconn *conn, void (*callback)(void *context, const flib_room **rooms, int roomCount), void* context); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
490 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
491 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
492 |
* Response to flib_netconn_send_joinRoom, flib_netconn_send_playerFollow or |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
493 |
* flib_netconn_send_createRoom. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
494 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
495 |
* You just left the lobby and entered a room. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
496 |
* If chief is true, you can and should send a full configuration for the room now. This |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
497 |
* consists of ammo, scheme, script and map, where map apparently has to come last. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
498 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
499 |
void flib_netconn_onEnterRoom(flib_netconn *conn, void (*callback)(void *context, bool chief), void *context); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
500 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
501 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
502 |
* Response to flib_netconn_send_addTeam. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
503 |
* The server might reject your team for several reasons, e.g. because it has the same name as |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
504 |
* an existing team, or because the room chief restricted adding new teams. If the team is |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
505 |
* accepted by the server, this callback is fired. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
506 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
507 |
* If you are the room chief, you are expected to provide the hog count for your own team now |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
508 |
* using flib_netconn_send_teamHogCount. The color of the team is already set to the one you |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
509 |
* provided in addTeam. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
510 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
511 |
void flib_netconn_onTeamAccepted(flib_netconn *conn, void (*callback)(void *context, const char *team), void *context); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
512 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
513 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
514 |
* When you query the server vars with flib_netconn_send_getServerVars (only works as admin), |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
515 |
* the server replies with a list of them. This callback is called for each entry in that list. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
516 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
517 |
void flib_netconn_onServerVar(flib_netconn *conn, void (*callback)(void *context, const char *name, const char *value), void *context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
518 |
|
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
519 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
520 |
// Callbacks that are only relevant in a room |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
521 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
522 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
523 |
* This callback informs about changes to your room chief status, i.e. whether you are allowed |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
524 |
* to modify the current room. Generally when you create a room you start out being room chief, |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
525 |
* and when you join an existing room you are not. However, if the original chief leaves a room, |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
526 |
* the server can choose a new chief, and if that happens this callback is called with the new |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
527 |
* status. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
528 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
529 |
* Note: This callback does not automatically fire when joining a room. You can always query the |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
530 |
* current chief status using flib_netconn_is_chief(). |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
531 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
532 |
void flib_netconn_onRoomChiefStatus(flib_netconn *conn, void (*callback)(void *context, bool chief), void* context); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
533 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
534 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
535 |
* One of the players in the room (possibly you) changed their ready state. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
536 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
537 |
void flib_netconn_onReadyState(flib_netconn *conn, void (*callback)(void *context, const char *nick, bool ready), void* context); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
538 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
539 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
540 |
* You just left a room and entered the lobby again. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
541 |
* reason is one of the NETCONN_ROOMLEAVE_ constants (usually a kick). |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
542 |
* This will not be called when you actively leave a room using PART. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
543 |
* Don't confuse with onRoomLeave, which indicates that *someone else* left the room. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
544 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
545 |
void flib_netconn_onLeaveRoom(flib_netconn *conn, void (*callback)(void *context, int reason, const char *message), void *context); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
546 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
547 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
548 |
* Someone joined or left the room you are currently in. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
549 |
* Analogous to onLobbyJoin/leave, you will receive the join callback for all players that are |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
550 |
* already in the room when you join, including for yourself (this is actually how it is |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
551 |
* determined that you joined a room). |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
552 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
553 |
* However, you will *not* receive onRoomLeave messages for everyone when you leave the room. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
554 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
555 |
void flib_netconn_onRoomJoin(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
556 |
void flib_netconn_onRoomLeave(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *partMessage), void* context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
557 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
558 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
559 |
* A new team was added to the room. The person who adds a team does NOT receive this callback |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
560 |
* (he gets onTeamAccepted instead). |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
561 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
562 |
* The team does not contain bindings, stats, weaponset, color or the number of hogs (but it is |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
563 |
* assumed to be the default of 4). |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
564 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
565 |
* If you receive this message and you are the room chief, you may want to send a color and hog |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
566 |
* count for this team using flib_netconn_send_teamHogCount / teamColor for QtFrontend |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
567 |
* compatibility. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
568 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
569 |
* The server currently sends another message with the color of the team to the same recipients |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
570 |
* as this teamAdd message, which will trigger an onTeamColorChanged callback. See the |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
571 |
* description of flib_netconn_send_addTeam for more information. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
572 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
573 |
void flib_netconn_onTeamAdd(flib_netconn *conn, void (*callback)(void *context, const flib_team *team), void *context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
574 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
575 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
576 |
* A team was removed from the room. The person who removed the team will not receive this |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
577 |
* callback. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
578 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
579 |
void flib_netconn_onTeamDelete(flib_netconn *conn, void (*callback)(void *context, const char *teamname), void *context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
580 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
581 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
582 |
* The number of hogs in a team has been changed by the room chief. If you are the chief and |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
583 |
* change the number of hogs yourself, you will not receive this callback. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
584 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
585 |
void flib_netconn_onHogCountChanged(flib_netconn *conn, void (*callback)(void *context, const char *teamName, int hogs), void *context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
586 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
587 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
588 |
* The color of a team has been set or changed. The client who set or changed the color will |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
589 |
* not receive this callback. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
590 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
591 |
* Normally, only the chief can change the color of a team. However, this message is also |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
592 |
* generated when a team is added, so you can receive it even as chief. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
593 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
594 |
void flib_netconn_onTeamColorChanged(flib_netconn *conn, void (*callback)(void *context, const char *teamName, int colorIndex), void *context); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
595 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
596 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
597 |
* The room chief has changed the game scheme (or you just joined a room). |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
598 |
* You will not receive this callback if you changed the scheme yourself. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
599 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
600 |
void flib_netconn_onSchemeChanged(flib_netconn *conn, void (*callback)(void *context, const flib_scheme *scheme), void *context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
601 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
602 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
603 |
* The room chief has changed the map (or you just joined a room). Only non-chiefs receive these |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
604 |
* messages. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
605 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
606 |
* To reduce the number of callback functions, the netconn keeps track of the current map |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
607 |
* settings and always passes the entire current map config, but informs the callee about what |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
608 |
* has changed (see the NETCONN_MAPCHANGE_ constants). |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
609 |
* |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
610 |
* Caution: Due to the way the protocol works, the map might not be complete at this point if it |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
611 |
* is a hand-drawn map, because the "full" map config does not include the drawn map data. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
612 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
613 |
void flib_netconn_onMapChanged(flib_netconn *conn, void (*callback)(void *context, const flib_map *map, int changetype), void *context); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
614 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
615 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
616 |
* The room chief has changed the game style (or you just joined a room). If you are the chief |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
617 |
* and change the style yourself, you will not receive this callback. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
618 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
619 |
void flib_netconn_onScriptChanged(flib_netconn *conn, void (*callback)(void *context, const char *script), void *context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
620 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
621 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
622 |
* The room chief has changed the weaponset (or you just joined a room). If you are the chief |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
623 |
* and change the weaponset yourself, you will not receive this callback. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
624 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
625 |
void flib_netconn_onWeaponsetChanged(flib_netconn *conn, void (*callback)(void *context, const flib_weaponset *weaponset), void *context); |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
626 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
627 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
628 |
* The game is starting. Fire up the engine and join in! |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
629 |
* You can let the netconn generate the right game setup using flib_netconn_create_gamesetup |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
630 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
631 |
void flib_netconn_onRunGame(flib_netconn *conn, void (*callback)(void *context), void *context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
632 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
633 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
634 |
* You are in a room, a game is in progress, and the server is sending you the new input for the |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
635 |
* engine to keep up to date with the current happenings. Pass it on to the engine using |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
636 |
* flib_gameconn_send_enginemsg. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
637 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
638 |
void flib_netconn_onEngineMessage(flib_netconn *conn, void (*callback)(void *context, const uint8_t *message, size_t size), void *context); |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
639 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
640 |
|
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
641 |
// Callbacks only needed for admin stuffs |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7269
diff
changeset
|
642 |
|
7580
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
643 |
/** |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
644 |
* This callback is called if the server informs us that we have admin rights. |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
645 |
*/ |
c92596feac0d
frontlib: Improved documentation of netconn, unified naming of a callback
Medo <smaxein@googlemail.com>
parents:
7497
diff
changeset
|
646 |
void flib_netconn_onAdminAccess(flib_netconn *conn, void (*callback)(void *context), void *context); |
7269
5b0aeef8ba2a
More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents:
7234
diff
changeset
|
647 |
|
7234
613998625a3c
frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
648 |
#endif |