project_files/frontlib/net/netconn.h
changeset 10017 de822cd3df3a
parent 10015 4feced261c68
equal deleted inserted replaced
10015:4feced261c68 10017:de822cd3df3a
    66 #define NETCONN_STATE_CONNECTING 0
    66 #define NETCONN_STATE_CONNECTING 0
    67 #define NETCONN_STATE_LOBBY 1
    67 #define NETCONN_STATE_LOBBY 1
    68 #define NETCONN_STATE_ROOM 2
    68 #define NETCONN_STATE_ROOM 2
    69 #define NETCONN_STATE_DISCONNECTED 10
    69 #define NETCONN_STATE_DISCONNECTED 10
    70 
    70 
    71 #define NETCONN_DISCONNECT_NORMAL 0				//!< The connection was closed normally
    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
    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
    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
    74 #define NETCONN_DISCONNECT_CONNLOST 3           //!< The network connection was lost
    75 #define NETCONN_DISCONNECT_INTERNAL_ERROR 100	//!< Something went wrong in frontlib itself
    75 #define NETCONN_DISCONNECT_INTERNAL_ERROR 100   //!< Something went wrong in frontlib itself
    76 
    76 
    77 #define NETCONN_ROOMLEAVE_ABANDONED 0			//!< The room was closed because the chief left
    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
    78 #define NETCONN_ROOMLEAVE_KICKED 1              //!< You have been kicked from the room
    79 
    79 
    80 #define NETCONN_MSG_TYPE_PLAYERINFO 0			//!< A response to flib_netconn_send_playerInfo
    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
    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
    82 #define NETCONN_MSG_TYPE_WARNING 2              //!< A general warning message
    83 #define NETCONN_MSG_TYPE_ERROR 3				//!< A general error message
    83 #define NETCONN_MSG_TYPE_ERROR 3                //!< A general error message
    84 
    84 
    85 #define NETCONN_MAPCHANGE_FULL 0
    85 #define NETCONN_MAPCHANGE_FULL 0
    86 #define NETCONN_MAPCHANGE_MAP 1
    86 #define NETCONN_MAPCHANGE_MAP 1
    87 #define NETCONN_MAPCHANGE_MAPGEN 2
    87 #define NETCONN_MAPCHANGE_MAPGEN 2
    88 #define NETCONN_MAPCHANGE_DRAWNMAP 3
    88 #define NETCONN_MAPCHANGE_DRAWNMAP 3
   131 
   131 
   132 
   132 
   133 
   133 
   134 // Send functions needed when connecting and disconnecting
   134 // Send functions needed when connecting and disconnecting
   135 
   135 
   136 	/**
   136     /**
   137 	 * Request a different nickname.
   137      * Request a different nickname.
   138 	 * This function only makes sense in reaction to an onNickTaken callback, because the netconn
   138      * This function only makes sense in reaction to an onNickTaken callback, because the netconn
   139 	 * automatically requests the nickname you provide on creation, and once the server accepts the
   139      * automatically requests the nickname you provide on creation, and once the server accepts the
   140 	 * nickname it can no longer be changed.
   140      * nickname it can no longer be changed.
   141 	 */
   141      */
   142 	int flib_netconn_send_nick(flib_netconn *conn, const char *nick);
   142     int flib_netconn_send_nick(flib_netconn *conn, const char *nick);
   143 
   143 
   144 	/**
   144     /**
   145 	 * Send the password in reply to a password request.
   145      * Send the password in reply to a password request.
   146 	 * If the server does not accept the password, you will be disconnected
   146      * If the server does not accept the password, you will be disconnected
   147 	 * (NETCONN_DISCONNECT_AUTH_FAILED)
   147      * (NETCONN_DISCONNECT_AUTH_FAILED)
   148 	 */
   148      */
   149 	int flib_netconn_send_password(flib_netconn *conn, const char *passwd);
   149     int flib_netconn_send_password(flib_netconn *conn, const char *passwd);
   150 
   150 
   151 	/**
   151     /**
   152 	 * Tell the server that you want to leave. If successful, the server will disconnect you.
   152      * Tell the server that you want to leave. If successful, the server will disconnect you.
   153 	 */
   153      */
   154 	int flib_netconn_send_quit(flib_netconn *conn, const char *quitmsg);
   154     int flib_netconn_send_quit(flib_netconn *conn, const char *quitmsg);
   155 
   155 
   156 
   156 
   157 // Send functions that make sense both in the lobby and in rooms
   157 // Send functions that make sense both in the lobby and in rooms
   158 
   158 
   159 	/**
   159     /**
   160 	 * Send a chat message. This message is either sent to the lobby or the room, depending on
   160      * Send a chat message. This message is either sent to the lobby or the room, depending on
   161 	 * whether you are in a room at the moment. The message is not echoed back to you.
   161      * whether you are in a room at the moment. The message is not echoed back to you.
   162 	 */
   162      */
   163 	int flib_netconn_send_chat(flib_netconn *conn, const char *chat);
   163     int flib_netconn_send_chat(flib_netconn *conn, const char *chat);
   164 
   164 
   165 	/**
   165     /**
   166 	 * Kick a player. This has different meanings in the lobby and in a room;
   166      * Kick a player. This has different meanings in the lobby and in a room;
   167 	 * In the lobby, it will kick the player from the server, and you need to be a server admin to
   167      * In the lobby, it will kick the player from the server, and you need to be a server admin to
   168 	 * do it. In a room, it will kick the player from the room, and you need to be room chief.
   168      * do it. In a room, it will kick the player from the room, and you need to be room chief.
   169 	 */
   169      */
   170 	int flib_netconn_send_kick(flib_netconn *conn, const char *playerName);
   170     int flib_netconn_send_kick(flib_netconn *conn, const char *playerName);
   171 
   171 
   172 	/**
   172     /**
   173 	 * Request information about a player (e.g. current room, version, partial IP). If the action
   173      * Request information about a player (e.g. current room, version, partial IP). If the action
   174 	 * succeeds, you will receive an onMessage callback with NETCONN_MSG_TYPE_PLAYERINFO containing
   174      * succeeds, you will receive an onMessage callback with NETCONN_MSG_TYPE_PLAYERINFO containing
   175 	 * the requested information.
   175      * the requested information.
   176 	 */
   176      */
   177 	int flib_netconn_send_playerInfo(flib_netconn *conn, const char *playerName);
   177     int flib_netconn_send_playerInfo(flib_netconn *conn, const char *playerName);
   178 
   178 
   179 
   179 
   180 // Send functions that only make sense in the lobby
   180 // Send functions that only make sense in the lobby
   181 
   181 
   182 	/**
   182     /**
   183 	 * Request an update of the room list. Only makes sense when in lobby state.
   183      * Request an update of the room list. Only makes sense when in lobby state.
   184 	 * If the action succeeds, you will receive an onRoomlist callback containing the current room
   184      * If the action succeeds, you will receive an onRoomlist callback containing the current room
   185 	 * data.
   185      * data.
   186 	 */
   186      */
   187 	int flib_netconn_send_request_roomlist(flib_netconn *conn);
   187     int flib_netconn_send_request_roomlist(flib_netconn *conn);
   188 
   188 
   189 	/**
   189     /**
   190 	 * Join a room as guest (not chief). Only makes sense when in lobby state. If the action
   190      * Join a room as guest (not chief). Only makes sense when in lobby state. If the action
   191 	 * succeeds, you will receive an onEnterRoom callback with chief=false followed by other
   191      * succeeds, you will receive an onEnterRoom callback with chief=false followed by other
   192 	 * callbacks with current room information.
   192      * callbacks with current room information.
   193 	 */
   193      */
   194 	int flib_netconn_send_joinRoom(flib_netconn *conn, const char *room);
   194     int flib_netconn_send_joinRoom(flib_netconn *conn, const char *room);
   195 
   195 
   196 	/**
   196     /**
   197 	 * Follow a player. Only valid in the lobby. If the player is in a room (or in a game), this
   197      * Follow a player. Only valid in the lobby. If the player is in a room (or in a game), this
   198 	 * command is analogous to calling flib_netconn_send_joinRoom with that room.
   198      * command is analogous to calling flib_netconn_send_joinRoom with that room.
   199 	 */
   199      */
   200 	int flib_netconn_send_playerFollow(flib_netconn *conn, const char *playerName);
   200     int flib_netconn_send_playerFollow(flib_netconn *conn, const char *playerName);
   201 
   201 
   202 	/**
   202     /**
   203 	 * Create and join a new room. Only makes sense when in lobby state. If the action succeeds,
   203      * Create and join a new room. Only makes sense when in lobby state. If the action succeeds,
   204 	 * you will receive an onEnterRoom callback with chief=true.
   204      * you will receive an onEnterRoom callback with chief=true.
   205 	 */
   205      */
   206 	int flib_netconn_send_createRoom(flib_netconn *conn, const char *room);
   206     int flib_netconn_send_createRoom(flib_netconn *conn, const char *room);
   207 
   207 
   208 	/**
   208     /**
   209 	 * Ban a player. The scope of this ban depends on whether you are in a room or in the lobby.
   209      * Ban a player. The scope of this ban depends on whether you are in a room or in the lobby.
   210 	 * In a room, you need to be the room chief, and the ban will apply to the room only. In the
   210      * In a room, you need to be the room chief, and the ban will apply to the room only. In the
   211 	 * lobby, you need to be server admin to ban someone, and the ban applies to the entire server.
   211      * lobby, you need to be server admin to ban someone, and the ban applies to the entire server.
   212 	 */
   212      */
   213 	int flib_netconn_send_ban(flib_netconn *conn, const char *playerName);
   213     int flib_netconn_send_ban(flib_netconn *conn, const char *playerName);
   214 
   214 
   215 	/**
   215     /**
   216 	 * Does something administrator-y. At any rate you need to be an administrator and in the lobby
   216      * Does something administrator-y. At any rate you need to be an administrator and in the lobby
   217 	 * to use this command.
   217      * to use this command.
   218 	 */
   218      */
   219 	int flib_netconn_send_clearAccountsCache(flib_netconn *conn);
   219     int flib_netconn_send_clearAccountsCache(flib_netconn *conn);
   220 
   220 
   221 	/**
   221     /**
   222 	 * Sets a server variable to the indicated value. Only makes sense if you are server admin and
   222      * Sets a server variable to the indicated value. Only makes sense if you are server admin and
   223 	 * in the lobby. Known variables are MOTD_NEW, MOTD_OLD and LATEST_PROTO. MOTD_OLD is shown to
   223      * in the lobby. Known variables are MOTD_NEW, MOTD_OLD and LATEST_PROTO. MOTD_OLD is shown to
   224 	 * players with older protocol versions, to inform them that they might want to update.
   224      * players with older protocol versions, to inform them that they might want to update.
   225 	 */
   225      */
   226 	int flib_netconn_send_setServerVar(flib_netconn *conn, const char *name, const char *value);
   226     int flib_netconn_send_setServerVar(flib_netconn *conn, const char *name, const char *value);
   227 
   227 
   228 	/**
   228     /**
   229 	 * Queries all server variables. Only makes sense if you are server admin and in the lobby.
   229      * Queries all server variables. Only makes sense if you are server admin and in the lobby.
   230 	 * If the action succeeds, you will receive several onServerVar callbacks with the
   230      * If the action succeeds, you will receive several onServerVar callbacks with the
   231 	 * current values of all server variables.
   231      * current values of all server variables.
   232 	 */
   232      */
   233 	int flib_netconn_send_getServerVars(flib_netconn *conn);
   233     int flib_netconn_send_getServerVars(flib_netconn *conn);
   234 
   234 
   235 
   235 
   236 // Send functions that only make sense in a room
   236 // Send functions that only make sense in a room
   237 
   237 
   238 	/**
   238     /**
   239 	 * Leave the room for the lobby. Only makes sense in room state. msg can be NULL if you don't
   239      * Leave the room for the lobby. Only makes sense in room state. msg can be NULL if you don't
   240 	 * want to send a message. The server always accepts a part command, so once you send it off,
   240      * want to send a message. The server always accepts a part command, so once you send it off,
   241 	 * you can just assume that you are back in the lobby.
   241      * you can just assume that you are back in the lobby.
   242 	 */
   242      */
   243 	int flib_netconn_send_leaveRoom(flib_netconn *conn, const char *msg);
   243     int flib_netconn_send_leaveRoom(flib_netconn *conn, const char *msg);
   244 
   244 
   245 	/**
   245     /**
   246 	 * Change your "ready" status in the room. Only makes sense when in room state. If the action
   246      * Change your "ready" status in the room. Only makes sense when in room state. If the action
   247 	 * succeeds, you will receive an onClientFlags callback containing the change.
   247      * succeeds, you will receive an onClientFlags callback containing the change.
   248 	 */
   248      */
   249 	int flib_netconn_send_toggleReady(flib_netconn *conn);
   249     int flib_netconn_send_toggleReady(flib_netconn *conn);
   250 
   250 
   251 	/**
   251     /**
   252 	 * Add a team to the current room. Apart from the "fixed" team information, this also includes
   252      * Add a team to the current room. Apart from the "fixed" team information, this also includes
   253 	 * the color, but not the number of hogs. Only makes sense when in room state. If the action
   253      * the color, but not the number of hogs. Only makes sense when in room state. If the action
   254 	 * succeeds, you will receive an onTeamAccepted callback with the name of the team.
   254      * succeeds, you will receive an onTeamAccepted callback with the name of the team.
   255 	 *
   255      *
   256 	 * Notes: Technically, sending a color here is the only way for a non-chief to set the color of
   256      * Notes: Technically, sending a color here is the only way for a non-chief to set the color of
   257 	 * her own team. The server remembers this color and even generates a separate teamColor message
   257      * her own team. The server remembers this color and even generates a separate teamColor message
   258 	 * to inform everyone of it. However, at the moment the frontends generally override this color
   258      * to inform everyone of it. However, at the moment the frontends generally override this color
   259 	 * with one they choose themselves in order to deal with unfortunate behavior of the QtFrontend,
   259      * with one they choose themselves in order to deal with unfortunate behavior of the QtFrontend,
   260 	 * which always sends color index 0 when adding a team but thinks that the team has a random
   260      * which always sends color index 0 when adding a team but thinks that the team has a random
   261 	 * color. The chief always sends a new color in order to bring the QtFrontend back into sync.
   261      * color. The chief always sends a new color in order to bring the QtFrontend back into sync.
   262 	 */
   262      */
   263 	int flib_netconn_send_addTeam(flib_netconn *conn, const flib_team *team);
   263     int flib_netconn_send_addTeam(flib_netconn *conn, const flib_team *team);
   264 
   264 
   265 	/**
   265     /**
   266 	 * Remove the team with the name teamname. Only makes sense when in room state.
   266      * Remove the team with the name teamname. Only makes sense when in room state.
   267 	 * The server does not send a reply on success.
   267      * The server does not send a reply on success.
   268 	 */
   268      */
   269 	int flib_netconn_send_removeTeam(flib_netconn *conn, const char *teamname);
   269     int flib_netconn_send_removeTeam(flib_netconn *conn, const char *teamname);
   270 
   270 
   271 
   271 
   272 // Send functions that only make sense in a room and if you are room chief
   272 // Send functions that only make sense in a room and if you are room chief
   273 
   273 
   274 	/**
   274     /**
   275 	 * Rename the current room. Only makes sense in room state and if you are chief. If the action
   275      * Rename the current room. Only makes sense in room state and if you are chief. If the action
   276 	 * succeeds, you (and everyone else on the server) will receive an onRoomUpdate message
   276      * succeeds, you (and everyone else on the server) will receive an onRoomUpdate message
   277 	 * containing the change.
   277      * containing the change.
   278 	 */
   278      */
   279 	int flib_netconn_send_renameRoom(flib_netconn *conn, const char *roomName);
   279     int flib_netconn_send_renameRoom(flib_netconn *conn, const char *roomName);
   280 
   280 
   281 	/**
   281     /**
   282 	 * Set the number of hogs for a team. Only makes sense in room state and if you are chief.
   282      * Set the number of hogs for a team. Only makes sense in room state and if you are chief.
   283 	 * The server does not send a reply.
   283      * The server does not send a reply.
   284 	 */
   284      */
   285 	int flib_netconn_send_teamHogCount(flib_netconn *conn, const char *teamname, int hogcount);
   285     int flib_netconn_send_teamHogCount(flib_netconn *conn, const char *teamname, int hogcount);
   286 
   286 
   287 	/**
   287     /**
   288 	 * Set the teamcolor of a team. Only makes sense in room state and if you are chief.
   288      * Set the teamcolor of a team. Only makes sense in room state and if you are chief.
   289 	 * The server does not send a reply.
   289      * The server does not send a reply.
   290 	 */
   290      */
   291 	int flib_netconn_send_teamColor(flib_netconn *conn, const char *teamname, int colorIndex);
   291     int flib_netconn_send_teamColor(flib_netconn *conn, const char *teamname, int colorIndex);
   292 
   292 
   293 	/**
   293     /**
   294 	 * Set the weaponset for the room. Only makes sense in room state and if you are chief.
   294      * Set the weaponset for the room. Only makes sense in room state and if you are chief.
   295 	 * The server does not send a reply.
   295      * The server does not send a reply.
   296 	 */
   296      */
   297 	int flib_netconn_send_weaponset(flib_netconn *conn, const flib_weaponset *weaponset);
   297     int flib_netconn_send_weaponset(flib_netconn *conn, const flib_weaponset *weaponset);
   298 
   298 
   299 	/**
   299     /**
   300 	 * Set the map for the room. Only makes sense in room state and if you are chief.
   300      * Set the map for the room. Only makes sense in room state and if you are chief.
   301 	 * The server does not send a reply.
   301      * The server does not send a reply.
   302 	 */
   302      */
   303 	int flib_netconn_send_map(flib_netconn *conn, const flib_map *map);
   303     int flib_netconn_send_map(flib_netconn *conn, const flib_map *map);
   304 
   304 
   305 	/**
   305     /**
   306 	 * Set the mapname. Only makes sense in room state and if you are chief.
   306      * Set the mapname. Only makes sense in room state and if you are chief.
   307 	 * The server does not send a reply.
   307      * The server does not send a reply.
   308 	 */
   308      */
   309 	int flib_netconn_send_mapName(flib_netconn *conn, const char *mapName);
   309     int flib_netconn_send_mapName(flib_netconn *conn, const char *mapName);
   310 
   310 
   311 	/**
   311     /**
   312 	 * Set the map generator (regular, maze, drawn, named). Only makes sense in room state and if
   312      * Set the map generator (regular, maze, drawn, named). Only makes sense in room state and if
   313 	 * you are chief.
   313      * you are chief.
   314 	 * The server does not send a reply.
   314      * The server does not send a reply.
   315 	 */
   315      */
   316 	int flib_netconn_send_mapGen(flib_netconn *conn, int mapGen);
   316     int flib_netconn_send_mapGen(flib_netconn *conn, int mapGen);
   317 
   317 
   318 	/**
   318     /**
   319 	 * Set the map template for regular maps. Only makes sense in room state and if you are chief.
   319      * Set the map template for regular maps. Only makes sense in room state and if you are chief.
   320 	 * The server does not send a reply.
   320      * The server does not send a reply.
   321 	 */
   321      */
   322 	int flib_netconn_send_mapTemplate(flib_netconn *conn, int templateFilter);
   322     int flib_netconn_send_mapTemplate(flib_netconn *conn, int templateFilter);
   323 
   323 
   324 	/**
   324     /**
   325 	 * Set the maze template (maze size) for mazes. Only makes sense in room state and if you are
   325      * Set the maze template (maze size) for mazes. Only makes sense in room state and if you are
   326 	 * chief. The server does not send a reply.
   326      * chief. The server does not send a reply.
   327 	 */
   327      */
   328 	int flib_netconn_send_mapMazeSize(flib_netconn *conn, int mazeSize);
   328     int flib_netconn_send_mapMazeSize(flib_netconn *conn, int mazeSize);
   329 
   329 
   330 	/**
   330     /**
   331 	 * Set the seed for the map. Only makes sense in room state and if you are chief.
   331      * Set the seed for the map. Only makes sense in room state and if you are chief.
   332 	 * The server does not send a reply.
   332      * The server does not send a reply.
   333 	 */
   333      */
   334 	int flib_netconn_send_mapSeed(flib_netconn *conn, const char *seed);
   334     int flib_netconn_send_mapSeed(flib_netconn *conn, const char *seed);
   335 
   335 
   336 	/**
   336     /**
   337 	 * Set the theme for the map. Only makes sense in room state and if you are chief.
   337      * Set the theme for the map. Only makes sense in room state and if you are chief.
   338 	 * The server does not send a reply.
   338      * The server does not send a reply.
   339 	 */
   339      */
   340 	int flib_netconn_send_mapTheme(flib_netconn *conn, const char *theme);
   340     int flib_netconn_send_mapTheme(flib_netconn *conn, const char *theme);
   341 
   341 
   342 	/**
   342     /**
   343 	 * Set the draw data for the drawn map. Only makes sense in room state and if you are chief.
   343      * Set the draw data for the drawn map. Only makes sense in room state and if you are chief.
   344 	 * The server does not send a reply.
   344      * The server does not send a reply.
   345 	 */
   345      */
   346 	int flib_netconn_send_mapDrawdata(flib_netconn *conn, const uint8_t *drawData, size_t size);
   346     int flib_netconn_send_mapDrawdata(flib_netconn *conn, const uint8_t *drawData, size_t size);
   347 
   347 
   348 	/**
   348     /**
   349 	 * Set the script (game style). Only makes sense in room state and if you are chief.
   349      * Set the script (game style). Only makes sense in room state and if you are chief.
   350 	 * The server does not send a reply.
   350      * The server does not send a reply.
   351 	 */
   351      */
   352 	int flib_netconn_send_script(flib_netconn *conn, const char *scriptName);
   352     int flib_netconn_send_script(flib_netconn *conn, const char *scriptName);
   353 
   353 
   354 	/**
   354     /**
   355 	 * Set the scheme. Only makes sense in room state and if you are chief.
   355      * Set the scheme. Only makes sense in room state and if you are chief.
   356 	 * The server does not send a reply.
   356      * The server does not send a reply.
   357 	 */
   357      */
   358 	int flib_netconn_send_scheme(flib_netconn *conn, const flib_scheme *scheme);
   358     int flib_netconn_send_scheme(flib_netconn *conn, const flib_scheme *scheme);
   359 
   359 
   360 	/**
   360     /**
   361 	 * Signal that you want to start the game. Only makes sense in room state and if you are chief.
   361      * Signal that you want to start the game. Only makes sense in room state and if you are chief.
   362 	 * The server will check whether all players are ready and whether it believes the setup makes
   362      * The server will check whether all players are ready and whether it believes the setup makes
   363 	 * sense (e.g. more than one clan). If the server is satisfied, you will receive an onRunGame
   363      * sense (e.g. more than one clan). If the server is satisfied, you will receive an onRunGame
   364 	 * callback (all other clients in the room are notified the same way). Otherwise the server
   364      * callback (all other clients in the room are notified the same way). Otherwise the server
   365 	 * might answer with a warning, or might not answer at all.
   365      * might answer with a warning, or might not answer at all.
   366 	 */
   366      */
   367 	int flib_netconn_send_startGame(flib_netconn *conn);
   367     int flib_netconn_send_startGame(flib_netconn *conn);
   368 
   368 
   369 	/**
   369     /**
   370 	 * Allow/forbid players to join the room. Only makes sense in room state and if you are chief.
   370      * Allow/forbid players to join the room. Only makes sense in room state and if you are chief.
   371 	 * The server does not send a reply.
   371      * The server does not send a reply.
   372 	 */
   372      */
   373 	int flib_netconn_send_toggleRestrictJoins(flib_netconn *conn);
   373     int flib_netconn_send_toggleRestrictJoins(flib_netconn *conn);
   374 
   374 
   375 	/**
   375     /**
   376 	 * Allow/forbid adding teams to the room. Only makes sense in room state and if you are chief.
   376      * Allow/forbid adding teams to the room. Only makes sense in room state and if you are chief.
   377 	 * The server does not send a reply.
   377      * The server does not send a reply.
   378 	 */
   378      */
   379 	int flib_netconn_send_toggleRestrictTeams(flib_netconn *conn);
   379     int flib_netconn_send_toggleRestrictTeams(flib_netconn *conn);
   380 
   380 
   381 
   381 
   382 // Send functions that are only needed for running a game
   382 // Send functions that are only needed for running a game
   383 
   383 
   384 	/**
   384     /**
   385 	 * Send a teamchat message, forwarded from the engine. Only makes sense ingame.
   385      * Send a teamchat message, forwarded from the engine. Only makes sense ingame.
   386 	 * The server does not send a reply. In contrast to a Chat message, the server
   386      * The server does not send a reply. In contrast to a Chat message, the server
   387 	 * automatically converts this into an engine message and passes it on to the other
   387      * automatically converts this into an engine message and passes it on to the other
   388 	 * clients.
   388      * clients.
   389 	 */
   389      */
   390 	int flib_netconn_send_teamchat(flib_netconn *conn, const char *msg);
   390     int flib_netconn_send_teamchat(flib_netconn *conn, const char *msg);
   391 
   391 
   392 	/**
   392     /**
   393 	 * Send an engine message. Only makes sense when ingame. In a networked game, you have to pass
   393      * Send an engine message. Only makes sense when ingame. In a networked game, you have to pass
   394 	 * all the engine messages from the engine here, and they will be spread to all other clients
   394      * all the engine messages from the engine here, and they will be spread to all other clients
   395 	 * in the game to keep the game in sync.
   395      * in the game to keep the game in sync.
   396 	 */
   396      */
   397 	int flib_netconn_send_engineMessage(flib_netconn *conn, const uint8_t *message, size_t size);
   397     int flib_netconn_send_engineMessage(flib_netconn *conn, const uint8_t *message, size_t size);
   398 
   398 
   399 	/**
   399     /**
   400 	 * Inform the server that the round has ended. Call this when the engine has disconnected,
   400      * Inform the server that the round has ended. Call this when the engine has disconnected,
   401 	 * passing 1 if the round ended normally, 0 otherwise.
   401      * passing 1 if the round ended normally, 0 otherwise.
   402 	 */
   402      */
   403 	int flib_netconn_send_roundfinished(flib_netconn *conn, bool withoutError);
   403     int flib_netconn_send_roundfinished(flib_netconn *conn, bool withoutError);
   404 
   404 
   405 
   405 
   406 
   406 
   407 
   407 
   408 
   408 
   409 // Callbacks that are important for connecting/disconnecting
   409 // Callbacks that are important for connecting/disconnecting
   410 
   410 
   411 	/**
   411     /**
   412 	 * onNickTaken is called when connecting to the server, if it turns out that there is already a
   412      * onNickTaken is called when connecting to the server, if it turns out that there is already a
   413 	 * player with the same nick.
   413      * player with the same nick.
   414 	 * In order to proceed, a new nickname needs to be sent to the server using
   414      * In order to proceed, a new nickname needs to be sent to the server using
   415 	 * flib_netconn_send_nick() (or of course you can bail out and send a QUIT).
   415      * flib_netconn_send_nick() (or of course you can bail out and send a QUIT).
   416 	 * If you don't set a callback, the netconn will automatically react by generating a new name.
   416      * If you don't set a callback, the netconn will automatically react by generating a new name.
   417 	 */
   417      */
   418 	void flib_netconn_onNickTaken(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
   418     void flib_netconn_onNickTaken(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
   419 
   419 
   420 	/**
   420     /**
   421 	 * When connecting with a registered nickname, the server will ask for a password before
   421      * When connecting with a registered nickname, the server will ask for a password before
   422 	 * admitting you in. This callback is called when that happens. As a reaction, you can send the
   422      * admitting you in. This callback is called when that happens. As a reaction, you can send the
   423 	 * password using flib_netconn_send_password. If you don't register a callback, the default
   423      * password using flib_netconn_send_password. If you don't register a callback, the default
   424 	 * behavior is to just quit in a way that will cause a disconnect with
   424      * behavior is to just quit in a way that will cause a disconnect with
   425 	 * NETCONN_DISCONNECT_AUTH_FAILED.
   425      * NETCONN_DISCONNECT_AUTH_FAILED.
   426 	 *
   426      *
   427 	 * You can't just choose a new nickname when you receive this callback, because at that point
   427      * You can't just choose a new nickname when you receive this callback, because at that point
   428 	 * the server has already accepted your nick.
   428      * the server has already accepted your nick.
   429 	 */
   429      */
   430 	void flib_netconn_onPasswordRequest(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
   430     void flib_netconn_onPasswordRequest(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
   431 
   431 
   432 	/**
   432     /**
   433 	 * This is called when the server has accepted our nickname (and possibly password) and we have
   433      * This is called when the server has accepted our nickname (and possibly password) and we have
   434 	 * entered the lobby.
   434      * entered the lobby.
   435 	 */
   435      */
   436 	void flib_netconn_onConnected(flib_netconn *conn, void (*callback)(void *context), void* context);
   436     void flib_netconn_onConnected(flib_netconn *conn, void (*callback)(void *context), void* context);
   437 
   437 
   438 	/**
   438     /**
   439 	 * This is always the last callback (unless the netconn is destroyed early), and the netconn
   439      * This is always the last callback (unless the netconn is destroyed early), and the netconn
   440 	 * should be destroyed when it is received. The reason for the disconnect is passed as one of
   440      * should be destroyed when it is received. The reason for the disconnect is passed as one of
   441 	 * the NETCONN_DISCONNECT_ constants. Sometimes a message is included as well, but that
   441      * the NETCONN_DISCONNECT_ constants. Sometimes a message is included as well, but that
   442 	 * parameter might also be NULL.
   442      * parameter might also be NULL.
   443 	 */
   443      */
   444 	void flib_netconn_onDisconnected(flib_netconn *conn, void (*callback)(void *context, int reason, const char *message), void* context);
   444     void flib_netconn_onDisconnected(flib_netconn *conn, void (*callback)(void *context, int reason, const char *message), void* context);
   445 
   445 
   446 
   446 
   447 // Callbacks that make sense in most situations
   447 // Callbacks that make sense in most situations
   448 
   448 
   449 	/**
   449     /**
   450 	 * Callback for several informational messages that should be displayed to the user
   450      * Callback for several informational messages that should be displayed to the user
   451 	 * (e.g. in the chat window), but do not require a reaction. If a game is running, you might
   451      * (e.g. in the chat window), but do not require a reaction. If a game is running, you might
   452 	 * want to redirect some of these messages to the engine as well so the user will see them.
   452      * want to redirect some of these messages to the engine as well so the user will see them.
   453 	 */
   453      */
   454 	void flib_netconn_onMessage(flib_netconn *conn, void (*callback)(void *context, int msgtype, const char *msg), void* context);
   454     void flib_netconn_onMessage(flib_netconn *conn, void (*callback)(void *context, int msgtype, const char *msg), void* context);
   455 
   455 
   456 	/**
   456     /**
   457 	 * We received a chat message. Where this message belongs depends on the current state
   457      * We received a chat message. Where this message belongs depends on the current state
   458 	 * (lobby/room). If a game is running the message should be passed to the engine.
   458      * (lobby/room). If a game is running the message should be passed to the engine.
   459 	 */
   459      */
   460 	void flib_netconn_onChat(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *msg), void* context);
   460     void flib_netconn_onChat(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *msg), void* context);
   461 
   461 
   462 	/**
   462     /**
   463 	 * Callbacks for incremental room list updates. They will fire whenever these events occur,
   463      * Callbacks for incremental room list updates. They will fire whenever these events occur,
   464 	 * even before you first query the actual roomlist - so be sure not to blindly reference your
   464      * even before you first query the actual roomlist - so be sure not to blindly reference your
   465 	 * room list in these callbacks. The server currently only sends updates when a room changes
   465      * room list in these callbacks. The server currently only sends updates when a room changes
   466 	 * its name, so in order to update other room information you need to query the roomlist again
   466      * its name, so in order to update other room information you need to query the roomlist again
   467 	 * (see send_request_roomlist / onRoomlist).
   467      * (see send_request_roomlist / onRoomlist).
   468 	 */
   468      */
   469 	void flib_netconn_onRoomAdd(flib_netconn *conn, void (*callback)(void *context, const flib_room *room), void* context);
   469     void flib_netconn_onRoomAdd(flib_netconn *conn, void (*callback)(void *context, const flib_room *room), void* context);
   470 	void flib_netconn_onRoomDelete(flib_netconn *conn, void (*callback)(void *context, const char *name), void* context);
   470     void flib_netconn_onRoomDelete(flib_netconn *conn, void (*callback)(void *context, const char *name), void* context);
   471 	void flib_netconn_onRoomUpdate(flib_netconn *conn, void (*callback)(void *context, const char *oldName, const flib_room *room), void* context);
   471     void flib_netconn_onRoomUpdate(flib_netconn *conn, void (*callback)(void *context, const char *oldName, const flib_room *room), void* context);
   472 
   472 
   473 	/**
   473     /**
   474 	 * Callbacks for players joining or leaving the lobby. In contrast to the roomlist updates, you
   474      * Callbacks for players joining or leaving the lobby. In contrast to the roomlist updates, you
   475 	 * will get a JOIN callback for every player already on the server when you join (and there is
   475      * will get a JOIN callback for every player already on the server when you join (and there is
   476 	 * no direct way to query the current playerlist)
   476      * no direct way to query the current playerlist)
   477 	 *
   477      *
   478 	 * NOTE: partMessage may be NULL.
   478      * NOTE: partMessage may be NULL.
   479 	 */
   479      */
   480 	void flib_netconn_onLobbyJoin(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
   480     void flib_netconn_onLobbyJoin(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
   481 	void flib_netconn_onLobbyLeave(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *partMessage), void* context);
   481     void flib_netconn_onLobbyLeave(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *partMessage), void* context);
   482 
   482 
   483 	/**
   483     /**
   484 	 * This is called when the server informs us that one or more flags associated with a
   484      * This is called when the server informs us that one or more flags associated with a
   485 	 * player/client have changed.
   485      * player/client have changed.
   486 	 *
   486      *
   487 	 * nick is the name of the player, flags is a string containing one character for each modified
   487      * nick is the name of the player, flags is a string containing one character for each modified
   488 	 * flag (see below), and newFlagState signals whether the flags should be set to true or false.
   488      * flag (see below), and newFlagState signals whether the flags should be set to true or false.
   489 	 *
   489      *
   490 	 * Some of these flags are important for protocol purposes (especially if they are set for you)
   490      * Some of these flags are important for protocol purposes (especially if they are set for you)
   491 	 * while others are just informational. Also, some flags are only relevant for players who are
   491      * while others are just informational. Also, some flags are only relevant for players who are
   492 	 * in the same room as you, and the server will not inform you if they change for others.
   492      * in the same room as you, and the server will not inform you if they change for others.
   493 	 *
   493      *
   494 	 * These are the currently known/used flags:
   494      * These are the currently known/used flags:
   495 	 * a: Server admin. Always updated.
   495      * a: Server admin. Always updated.
   496 	 * h: Room chief. Updated when in the same room.
   496      * h: Room chief. Updated when in the same room.
   497 	 * r: Ready to play. Updated when in the same room.
   497      * r: Ready to play. Updated when in the same room.
   498 	 * u: Registered user. Always updated.
   498      * u: Registered user. Always updated.
   499 	 *
   499      *
   500 	 * The server tells us the 'a' and 'u' flags for all players when we first join the lobby, and
   500      * The server tells us the 'a' and 'u' flags for all players when we first join the lobby, and
   501 	 * also tells us the 'r' and 'h' flags when we join or create a room. It assumes that all flags
   501      * also tells us the 'r' and 'h' flags when we join or create a room. It assumes that all flags
   502 	 * are initially false, so it will typically only tell you to set certain flags to true when
   502      * are initially false, so it will typically only tell you to set certain flags to true when
   503 	 * transmitting the initial states. Reset the 'h' and 'r' flags to false when leaving a room,
   503      * transmitting the initial states. Reset the 'h' and 'r' flags to false when leaving a room,
   504 	 * or when entering room state, to arrive at the right state for each player.
   504      * or when entering room state, to arrive at the right state for each player.
   505 	 *
   505      *
   506 	 * The room chief state of yourself is particularly important because it determines whether you
   506      * The room chief state of yourself is particularly important because it determines whether you
   507 	 * can modify settings of the current room. Generally, when you create a room you start out
   507      * can modify settings of the current room. Generally, when you create a room you start out
   508 	 * being room chief, and when you join an existing room you are not. However, if the original
   508      * being room chief, and when you join an existing room you are not. However, if the original
   509 	 * chief leaves a room, the server can choose a new chief, and if that happens the chief flag
   509      * chief leaves a room, the server can choose a new chief, and if that happens the chief flag
   510 	 * will be transferred to someone else.
   510      * will be transferred to someone else.
   511 	 */
   511      */
   512 	void flib_netconn_onClientFlags(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *flags, bool newFlagState), void *context);
   512     void flib_netconn_onClientFlags(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *flags, bool newFlagState), void *context);
   513 
   513 
   514 // Callbacks that happen only in response to specific requests
   514 // Callbacks that happen only in response to specific requests
   515 
   515 
   516 	/**
   516     /**
   517 	 * Response to flib_netconn_send_request_roomlist().
   517      * Response to flib_netconn_send_request_roomlist().
   518 	 * The rooms array contains the current state of all rooms on the server.
   518      * The rooms array contains the current state of all rooms on the server.
   519 	 */
   519      */
   520 	void flib_netconn_onRoomlist(flib_netconn *conn, void (*callback)(void *context, const flib_room **rooms, int roomCount), void* context);
   520     void flib_netconn_onRoomlist(flib_netconn *conn, void (*callback)(void *context, const flib_room **rooms, int roomCount), void* context);
   521 
   521 
   522 	/**
   522     /**
   523 	 * Response to flib_netconn_send_joinRoom, flib_netconn_send_playerFollow or
   523      * Response to flib_netconn_send_joinRoom, flib_netconn_send_playerFollow or
   524 	 * flib_netconn_send_createRoom.
   524      * flib_netconn_send_createRoom.
   525 	 *
   525      *
   526 	 * You just left the lobby and entered a room.
   526      * You just left the lobby and entered a room.
   527 	 * If chief is true, you can and should send a full configuration for the room now. This
   527      * If chief is true, you can and should send a full configuration for the room now. This
   528 	 * consists of ammo, scheme, script and map, where map apparently has to come last.
   528      * consists of ammo, scheme, script and map, where map apparently has to come last.
   529 	 */
   529      */
   530 	void flib_netconn_onEnterRoom(flib_netconn *conn, void (*callback)(void *context, bool chief), void *context);
   530     void flib_netconn_onEnterRoom(flib_netconn *conn, void (*callback)(void *context, bool chief), void *context);
   531 
   531 
   532 	/**
   532     /**
   533 	 * Response to flib_netconn_send_addTeam.
   533      * Response to flib_netconn_send_addTeam.
   534 	 * The server might reject your team for several reasons, e.g. because it has the same name as
   534      * The server might reject your team for several reasons, e.g. because it has the same name as
   535 	 * an existing team, or because the room chief restricted adding new teams. If the team is
   535      * an existing team, or because the room chief restricted adding new teams. If the team is
   536 	 * accepted by the server, this callback is fired.
   536      * accepted by the server, this callback is fired.
   537 	 *
   537      *
   538 	 * If you are the room chief, you are expected to provide the hog count for your own team now
   538      * If you are the room chief, you are expected to provide the hog count for your own team now
   539 	 * using flib_netconn_send_teamHogCount. The color of the team is already set to the one you
   539      * using flib_netconn_send_teamHogCount. The color of the team is already set to the one you
   540 	 * provided in addTeam.
   540      * provided in addTeam.
   541 	 */
   541      */
   542 	void flib_netconn_onTeamAccepted(flib_netconn *conn, void (*callback)(void *context, const char *team), void *context);
   542     void flib_netconn_onTeamAccepted(flib_netconn *conn, void (*callback)(void *context, const char *team), void *context);
   543 
   543 
   544 	/**
   544     /**
   545 	 * When you query the server vars with flib_netconn_send_getServerVars (only works as admin),
   545      * When you query the server vars with flib_netconn_send_getServerVars (only works as admin),
   546 	 * the server replies with a list of them. This callback is called for each entry in that list.
   546      * the server replies with a list of them. This callback is called for each entry in that list.
   547 	 */
   547      */
   548 	void flib_netconn_onServerVar(flib_netconn *conn, void (*callback)(void *context, const char *name, const char *value), void *context);
   548     void flib_netconn_onServerVar(flib_netconn *conn, void (*callback)(void *context, const char *name, const char *value), void *context);
   549 
   549 
   550 
   550 
   551 // Callbacks that are only relevant in a room
   551 // Callbacks that are only relevant in a room
   552 
   552 
   553 	/**
   553     /**
   554 	 * You just left a room and entered the lobby again.
   554      * You just left a room and entered the lobby again.
   555 	 * reason is one of the NETCONN_ROOMLEAVE_ constants (usually a kick).
   555      * reason is one of the NETCONN_ROOMLEAVE_ constants (usually a kick).
   556 	 * This will not be called when you actively leave a room using PART.
   556      * This will not be called when you actively leave a room using PART.
   557 	 * Don't confuse with onRoomLeave, which indicates that *someone else* left the room.
   557      * Don't confuse with onRoomLeave, which indicates that *someone else* left the room.
   558 	 */
   558      */
   559 	void flib_netconn_onLeaveRoom(flib_netconn *conn, void (*callback)(void *context, int reason, const char *message), void *context);
   559     void flib_netconn_onLeaveRoom(flib_netconn *conn, void (*callback)(void *context, int reason, const char *message), void *context);
   560 
   560 
   561 	/**
   561     /**
   562 	 * Someone joined or left the room you are currently in.
   562      * Someone joined or left the room you are currently in.
   563 	 * Analogous to onLobbyJoin/leave, you will receive the join callback for all players that are
   563      * Analogous to onLobbyJoin/leave, you will receive the join callback for all players that are
   564 	 * already in the room when you join, including for yourself (this is actually how it is
   564      * already in the room when you join, including for yourself (this is actually how it is
   565 	 * determined that you joined a room).
   565      * determined that you joined a room).
   566 	 *
   566      *
   567 	 * However, you will *not* receive onRoomLeave messages for everyone when you leave the room.
   567      * However, you will *not* receive onRoomLeave messages for everyone when you leave the room.
   568 	 */
   568      */
   569 	void flib_netconn_onRoomJoin(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
   569     void flib_netconn_onRoomJoin(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
   570 	void flib_netconn_onRoomLeave(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *partMessage), void* context);
   570     void flib_netconn_onRoomLeave(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *partMessage), void* context);
   571 
   571 
   572 	/**
   572     /**
   573 	 * A new team was added to the room. The person who adds a team does NOT receive this callback
   573      * A new team was added to the room. The person who adds a team does NOT receive this callback
   574 	 * (he gets onTeamAccepted instead).
   574      * (he gets onTeamAccepted instead).
   575 	 *
   575      *
   576 	 * The team does not contain bindings, stats, weaponset, color or the number of hogs (but it is
   576      * The team does not contain bindings, stats, weaponset, color or the number of hogs (but it is
   577 	 * assumed to be the default of 4).
   577      * assumed to be the default of 4).
   578 	 *
   578      *
   579 	 * If you receive this message and you are the room chief, you may want to send a color and hog
   579      * If you receive this message and you are the room chief, you may want to send a color and hog
   580 	 * count for this team using flib_netconn_send_teamHogCount / teamColor for QtFrontend
   580      * count for this team using flib_netconn_send_teamHogCount / teamColor for QtFrontend
   581 	 * compatibility.
   581      * compatibility.
   582 	 *
   582      *
   583 	 * The server currently sends another message with the color of the team to the same recipients
   583      * The server currently sends another message with the color of the team to the same recipients
   584 	 * as this teamAdd message, which will trigger an onTeamColorChanged callback. See the
   584      * as this teamAdd message, which will trigger an onTeamColorChanged callback. See the
   585 	 * description of flib_netconn_send_addTeam for more information.
   585      * description of flib_netconn_send_addTeam for more information.
   586 	 */
   586      */
   587 	void flib_netconn_onTeamAdd(flib_netconn *conn, void (*callback)(void *context, const flib_team *team), void *context);
   587     void flib_netconn_onTeamAdd(flib_netconn *conn, void (*callback)(void *context, const flib_team *team), void *context);
   588 
   588 
   589 	/**
   589     /**
   590 	 * A team was removed from the room. The person who removed the team will not receive this
   590      * A team was removed from the room. The person who removed the team will not receive this
   591 	 * callback.
   591      * callback.
   592 	 */
   592      */
   593 	void flib_netconn_onTeamDelete(flib_netconn *conn, void (*callback)(void *context, const char *teamname), void *context);
   593     void flib_netconn_onTeamDelete(flib_netconn *conn, void (*callback)(void *context, const char *teamname), void *context);
   594 
   594 
   595 	/**
   595     /**
   596 	 * The number of hogs in a team has been changed by the room chief. If you are the chief and
   596      * The number of hogs in a team has been changed by the room chief. If you are the chief and
   597 	 * change the number of hogs yourself, you will not receive this callback.
   597      * change the number of hogs yourself, you will not receive this callback.
   598 	 */
   598      */
   599 	void flib_netconn_onHogCountChanged(flib_netconn *conn, void (*callback)(void *context, const char *teamName, int hogs), void *context);
   599     void flib_netconn_onHogCountChanged(flib_netconn *conn, void (*callback)(void *context, const char *teamName, int hogs), void *context);
   600 
   600 
   601 	/**
   601     /**
   602 	 * The color of a team has been set or changed. The client who set or changed the color will
   602      * The color of a team has been set or changed. The client who set or changed the color will
   603 	 * not receive this callback.
   603      * not receive this callback.
   604 	 *
   604      *
   605 	 * Normally, only the chief can change the color of a team. However, this message is also
   605      * Normally, only the chief can change the color of a team. However, this message is also
   606 	 * generated when a team is added, so you can receive it even as chief.
   606      * generated when a team is added, so you can receive it even as chief.
   607 	 */
   607      */
   608 	void flib_netconn_onTeamColorChanged(flib_netconn *conn, void (*callback)(void *context, const char *teamName, int colorIndex), void *context);
   608     void flib_netconn_onTeamColorChanged(flib_netconn *conn, void (*callback)(void *context, const char *teamName, int colorIndex), void *context);
   609 
   609 
   610 	/**
   610     /**
   611 	 * The room chief has changed the game scheme (or you just joined a room).
   611      * The room chief has changed the game scheme (or you just joined a room).
   612 	 * You will not receive this callback if you changed the scheme yourself.
   612      * You will not receive this callback if you changed the scheme yourself.
   613 	 */
   613      */
   614 	void flib_netconn_onSchemeChanged(flib_netconn *conn, void (*callback)(void *context, const flib_scheme *scheme), void *context);
   614     void flib_netconn_onSchemeChanged(flib_netconn *conn, void (*callback)(void *context, const flib_scheme *scheme), void *context);
   615 
   615 
   616 	/**
   616     /**
   617 	 * The room chief has changed the map (or you just joined a room). Only non-chiefs receive these
   617      * The room chief has changed the map (or you just joined a room). Only non-chiefs receive these
   618 	 * messages.
   618      * messages.
   619 	 *
   619      *
   620 	 * To reduce the number of callback functions, the netconn keeps track of the current map
   620      * To reduce the number of callback functions, the netconn keeps track of the current map
   621 	 * settings and always passes the entire current map config, but informs the callee about what
   621      * settings and always passes the entire current map config, but informs the callee about what
   622 	 * has changed (see the NETCONN_MAPCHANGE_ constants).
   622      * has changed (see the NETCONN_MAPCHANGE_ constants).
   623 	 *
   623      *
   624 	 * Caution: Due to the way the protocol works, the map might not be complete at this point if it
   624      * Caution: Due to the way the protocol works, the map might not be complete at this point if it
   625 	 * is a hand-drawn map, because the "full" map config does not include the drawn map data.
   625      * is a hand-drawn map, because the "full" map config does not include the drawn map data.
   626 	 */
   626      */
   627 	void flib_netconn_onMapChanged(flib_netconn *conn, void (*callback)(void *context, const flib_map *map, int changetype), void *context);
   627     void flib_netconn_onMapChanged(flib_netconn *conn, void (*callback)(void *context, const flib_map *map, int changetype), void *context);
   628 
   628 
   629 	/**
   629     /**
   630 	 * The room chief has changed the game style (or you just joined a room). If you are the chief
   630      * The room chief has changed the game style (or you just joined a room). If you are the chief
   631 	 * and change the style yourself, you will not receive this callback.
   631      * and change the style yourself, you will not receive this callback.
   632 	 */
   632      */
   633 	void flib_netconn_onScriptChanged(flib_netconn *conn, void (*callback)(void *context, const char *script), void *context);
   633     void flib_netconn_onScriptChanged(flib_netconn *conn, void (*callback)(void *context, const char *script), void *context);
   634 
   634 
   635 	/**
   635     /**
   636 	 * The room chief has changed the weaponset (or you just joined a room). If you are the chief
   636      * The room chief has changed the weaponset (or you just joined a room). If you are the chief
   637 	 * and change the weaponset yourself, you will not receive this callback.
   637      * and change the weaponset yourself, you will not receive this callback.
   638 	 */
   638      */
   639 	void flib_netconn_onWeaponsetChanged(flib_netconn *conn, void (*callback)(void *context, const flib_weaponset *weaponset), void *context);
   639     void flib_netconn_onWeaponsetChanged(flib_netconn *conn, void (*callback)(void *context, const flib_weaponset *weaponset), void *context);
   640 
   640 
   641 	/**
   641     /**
   642 	 * The game is starting. Fire up the engine and join in!
   642      * The game is starting. Fire up the engine and join in!
   643 	 * You can let the netconn generate the right game setup using flib_netconn_create_gamesetup
   643      * You can let the netconn generate the right game setup using flib_netconn_create_gamesetup
   644 	 */
   644      */
   645 	void flib_netconn_onRunGame(flib_netconn *conn, void (*callback)(void *context), void *context);
   645     void flib_netconn_onRunGame(flib_netconn *conn, void (*callback)(void *context), void *context);
   646 
   646 
   647 	/**
   647     /**
   648 	 * You are in a room, a game is in progress, and the server is sending you the new input for the
   648      * You are in a room, a game is in progress, and the server is sending you the new input for the
   649 	 * engine to keep up to date with the current happenings. Pass it on to the engine using
   649      * engine to keep up to date with the current happenings. Pass it on to the engine using
   650 	 * flib_gameconn_send_enginemsg.
   650      * flib_gameconn_send_enginemsg.
   651 	 */
   651      */
   652 	void flib_netconn_onEngineMessage(flib_netconn *conn, void (*callback)(void *context, const uint8_t *message, size_t size), void *context);
   652     void flib_netconn_onEngineMessage(flib_netconn *conn, void (*callback)(void *context, const uint8_t *message, size_t size), void *context);
   653 
   653 
   654 #endif
   654 #endif