project_files/frontlib/net/netconn_callbacks.c
author Medo <smaxein@googlemail.com>
Mon, 25 Jun 2012 15:21:18 +0200
changeset 7273 8eed495fd8da
child 7275 15f722e0b96f
permissions -rw-r--r--
frontlib: Using macros for simplification of callbacks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7273
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
     1
#include "netconn_internal.h"
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
     2
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
     3
#include "../util/logging.h"
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
     4
#include "../util/util.h"
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
     5
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
     6
#include <string.h>
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
     7
#include <stdlib.h>
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
     8
#include <ctype.h>
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
     9
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    10
static void defaultCallback_onMessage(void *context, int msgtype, const char *msg) {
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    11
	flib_log_i("Net: [%i] %s", msgtype, msg);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    12
}
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    13
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    14
static void defaultCallback_onChat(void *context, const char *nick, const char *msg) {
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    15
	flib_log_i("%s: %s", nick, msg);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    16
}
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    17
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    18
// Change the name by suffixing it with a number. If it already ends in a number, increase that number by 1.
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    19
static void defaultCallback_onNickTaken(void *context, const char *requestedNick) {
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
	flib_netconn *conn = context;
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
	size_t namelen = strlen(requestedNick);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
	int digits = 0;
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    23
	while(digits<namelen && isdigit(requestedNick[namelen-1-digits])) {
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    24
		digits++;
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    25
	}
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    26
	long suffix = 0;
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    27
	if(digits>0) {
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    28
		suffix = atol(requestedNick+namelen-digits)+1;
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    29
	}
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    30
	char *newPlayerName = flib_asprintf("%.*s%li", namelen-digits, requestedNick, suffix);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    31
	if(newPlayerName) {
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    32
		flib_netconn_send_nick(conn, newPlayerName);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    33
	} else {
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    34
		flib_netconn_send_quit(conn, "Nick already taken.");
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    35
	}
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    36
	free(newPlayerName);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    37
}
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    38
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    39
// Default behavior: Quit
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    40
static void defaultCallback_onPasswordRequest(void *context, const char *requestedNick) {
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    41
	flib_netconn_send_quit((flib_netconn*)context, "Authentication failed");
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    42
}
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    43
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    44
void clearCallbacks(flib_netconn *conn) {
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    45
	flib_netconn_onMessage(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    46
	flib_netconn_onConnected(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    47
	flib_netconn_onDisconnected(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    48
	flib_netconn_onRoomAdd(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    49
	flib_netconn_onRoomDelete(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    50
	flib_netconn_onRoomUpdate(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    51
	flib_netconn_onChat(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    52
	flib_netconn_onLobbyJoin(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    53
	flib_netconn_onLobbyLeave(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    54
	flib_netconn_onRoomJoin(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    55
	flib_netconn_onRoomLeave(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    56
	flib_netconn_onNickTaken(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    57
	flib_netconn_onPasswordRequest(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    58
	flib_netconn_onRoomChiefStatus(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    59
	flib_netconn_onReadyState(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    60
	flib_netconn_onEnterRoom(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    61
	flib_netconn_onLeaveRoom(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    62
	flib_netconn_onTeamAdd(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    63
	flib_netconn_onTeamDelete(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    64
	flib_netconn_onRunGame(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    65
	flib_netconn_onTeamAccepted(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    66
	flib_netconn_onHogCountChanged(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    67
	flib_netconn_onTeamColorChanged(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    68
	flib_netconn_onEngineMessage(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    69
	flib_netconn_onCfgScheme(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    70
	flib_netconn_onMapChanged(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    71
	flib_netconn_onScriptChanged(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    72
	flib_netconn_onWeaponsetChanged(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    73
	flib_netconn_onAdminAccess(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    74
	flib_netconn_onServerVar(conn, NULL, NULL);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    75
}
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    76
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    77
/**
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    78
 * This macro generates a callback setter function. It uses the name of the callback to
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    79
 * automatically generate the function name and the fields to set, so a consistent naming
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    80
 * convention needs to be enforced (not that that is a bad thing). If null is passed as
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    81
 * callback to the generated function, the defaultCb will be set instead (with conn
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    82
 * as the context).
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    83
 */
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    84
#define GENERATE_CB_SETTER(cbName, cbParameterTypes, defaultCb) \
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    85
	void flib_netconn_##cbName(flib_netconn *conn, void (*callback)cbParameterTypes, void *context) { \
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    86
		if(!conn) { \
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    87
			flib_log_e("null parameter in flib_netconn_%s", #cbName); \
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    88
		} else { \
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    89
			conn->cbName##Cb = callback ? callback : &defaultCb; \
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    90
			conn->cbName##Ctx = callback ? context : conn; \
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    91
		} \
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    92
	}
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    93
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    94
/**
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    95
 * Generate a callback setter function like GENERATE_CB_SETTER, and automatically generate a
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    96
 * no-op callback function as well that is used as default.
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    97
 */
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    98
#define GENERATE_CB_SETTER_AND_DEFAULT(cbName, cbParameterTypes) \
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
    99
	static void _noop_callback_##cbName cbParameterTypes {} \
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   100
	GENERATE_CB_SETTER(cbName, cbParameterTypes, _noop_callback_##cbName)
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   101
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   102
GENERATE_CB_SETTER(onMessage, (void *context, int msgtype, const char *msg), defaultCallback_onMessage);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   103
GENERATE_CB_SETTER_AND_DEFAULT(onConnected, (void *context));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   104
GENERATE_CB_SETTER_AND_DEFAULT(onDisconnected, (void *context, int reason, const char *message));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   105
GENERATE_CB_SETTER_AND_DEFAULT(onRoomAdd, (void *context, const flib_roomlist_room *room));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   106
GENERATE_CB_SETTER_AND_DEFAULT(onRoomDelete, (void *context, const char *name));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   107
GENERATE_CB_SETTER_AND_DEFAULT(onRoomUpdate, (void *context, const char *oldName, const flib_roomlist_room *room));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   108
GENERATE_CB_SETTER(onChat, (void *context, const char *nick, const char *msg), defaultCallback_onChat);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   109
GENERATE_CB_SETTER_AND_DEFAULT(onLobbyJoin, (void *context, const char *nick));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   110
GENERATE_CB_SETTER_AND_DEFAULT(onLobbyLeave, (void *context, const char *nick, const char *partMsg));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   111
GENERATE_CB_SETTER_AND_DEFAULT(onRoomJoin, (void *context, const char *nick));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   112
GENERATE_CB_SETTER_AND_DEFAULT(onRoomLeave, (void *context, const char *nick, const char *partMessage));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   113
GENERATE_CB_SETTER(onNickTaken, (void *context, const char *nick), defaultCallback_onNickTaken);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   114
GENERATE_CB_SETTER(onPasswordRequest, (void *context, const char *nick), defaultCallback_onPasswordRequest);
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   115
GENERATE_CB_SETTER_AND_DEFAULT(onRoomChiefStatus, (void *context, bool chief));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   116
GENERATE_CB_SETTER_AND_DEFAULT(onReadyState, (void *context, const char *nick, bool ready));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   117
GENERATE_CB_SETTER_AND_DEFAULT(onEnterRoom, (void *context, bool chief));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   118
GENERATE_CB_SETTER_AND_DEFAULT(onLeaveRoom, (void *context, int reason, const char *message));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   119
GENERATE_CB_SETTER_AND_DEFAULT(onTeamAdd, (void *context, flib_team *team));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   120
GENERATE_CB_SETTER_AND_DEFAULT(onTeamDelete, (void *context, const char *teamname));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   121
GENERATE_CB_SETTER_AND_DEFAULT(onRunGame, (void *context));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   122
GENERATE_CB_SETTER_AND_DEFAULT(onTeamAccepted, (void *context, const char *teamName));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   123
GENERATE_CB_SETTER_AND_DEFAULT(onHogCountChanged, (void *context, const char *teamName, int hogs));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   124
GENERATE_CB_SETTER_AND_DEFAULT(onTeamColorChanged, (void *context, const char *teamName, uint32_t colorRGB));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   125
GENERATE_CB_SETTER_AND_DEFAULT(onEngineMessage, (void *context, const char *message, int size));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   126
GENERATE_CB_SETTER_AND_DEFAULT(onCfgScheme, (void *context, flib_cfg *scheme));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   127
GENERATE_CB_SETTER_AND_DEFAULT(onMapChanged, (void *context, const flib_map *map, int changetype));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   128
GENERATE_CB_SETTER_AND_DEFAULT(onScriptChanged, (void *context, const char *script));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   129
GENERATE_CB_SETTER_AND_DEFAULT(onWeaponsetChanged, (void *context, flib_weaponset *weaponset));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   130
GENERATE_CB_SETTER_AND_DEFAULT(onAdminAccess, (void *context));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   131
GENERATE_CB_SETTER_AND_DEFAULT(onServerVar, (void *context, const char *name, const char *value));
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   132
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   133
#undef GENERATE_CB_SETTER_AND_DEFAULT
8eed495fd8da frontlib: Using macros for simplification of callbacks
Medo <smaxein@googlemail.com>
parents:
diff changeset
   134
#undef GENERATE_CB_SETTER