18 #include <stddef.h> |
18 #include <stddef.h> |
19 |
19 |
20 struct _flib_netconn { |
20 struct _flib_netconn { |
21 flib_netbase *netBase; |
21 flib_netbase *netBase; |
22 char *playerName; |
22 char *playerName; |
|
23 char *dataDirPath; |
|
24 |
|
25 int netconnState; // One of the NETCONN_STATE constants |
|
26 bool isAdmin; // Player is server administrator |
|
27 |
23 flib_cfg_meta *metaCfg; |
28 flib_cfg_meta *metaCfg; |
24 flib_roomlist *roomList; |
29 flib_roomlist roomList; |
25 |
30 |
26 int netconnState; // One of the NETCONN_STATE constants |
31 bool isChief; // Player can modify the current room |
27 |
32 flib_map *map; |
28 bool isAdmin; // Player is server administrator |
33 flib_teamlist pendingTeamlist; |
29 bool isChief; // Player can modify the current room |
34 flib_teamlist teamlist; |
30 flib_map *map; // Map settings in the current room. |
35 flib_cfg *scheme; |
|
36 char *script; |
|
37 flib_weaponset *weaponset; |
31 |
38 |
32 void (*onMessageCb)(void *context, int msgtype, const char *msg); |
39 void (*onMessageCb)(void *context, int msgtype, const char *msg); |
33 void *onMessageCtx; |
40 void *onMessageCtx; |
34 |
41 |
35 void (*onConnectedCb)(void *context); |
42 void (*onConnectedCb)(void *context); |
36 void *onConnectedCtx; |
43 void *onConnectedCtx; |
37 |
44 |
38 void (*onDisconnectedCb)(void *context, int reason, const char *message); |
45 void (*onDisconnectedCb)(void *context, int reason, const char *message); |
39 void *onDisconnectedCtx; |
46 void *onDisconnectedCtx; |
40 |
47 |
41 void (*onRoomAddCb)(void *context, const flib_roomlist_room *room); |
48 void (*onRoomAddCb)(void *context, const flib_room *room); |
42 void *onRoomAddCtx; |
49 void *onRoomAddCtx; |
43 |
50 |
44 void (*onRoomDeleteCb)(void *context, const char *name); |
51 void (*onRoomDeleteCb)(void *context, const char *name); |
45 void *onRoomDeleteCtx; |
52 void *onRoomDeleteCtx; |
46 |
53 |
47 void (*onRoomUpdateCb)(void *context, const char *oldName, const flib_roomlist_room *room); |
54 void (*onRoomUpdateCb)(void *context, const char *oldName, const flib_room *room); |
48 void *onRoomUpdateCtx; |
55 void *onRoomUpdateCtx; |
49 |
56 |
50 void (*onChatCb)(void *context, const char *nick, const char *msg); |
57 void (*onChatCb)(void *context, const char *nick, const char *msg); |
51 void *onChatCtx; |
58 void *onChatCtx; |
52 |
59 |
93 void *onTeamAcceptedCtx; |
100 void *onTeamAcceptedCtx; |
94 |
101 |
95 void (*onHogCountChangedCb)(void *context, const char *teamName, int hogs); |
102 void (*onHogCountChangedCb)(void *context, const char *teamName, int hogs); |
96 void *onHogCountChangedCtx; |
103 void *onHogCountChangedCtx; |
97 |
104 |
98 void (*onTeamColorChangedCb)(void *context, const char *teamName, uint32_t colorRGB); |
105 void (*onTeamColorChangedCb)(void *context, const char *teamName, int colorIndex); |
99 void *onTeamColorChangedCtx; |
106 void *onTeamColorChangedCtx; |
100 |
107 |
101 void (*onEngineMessageCb)(void *context, const char *message, int size); |
108 void (*onEngineMessageCb)(void *context, const uint8_t *message, size_t size); |
102 void *onEngineMessageCtx; |
109 void *onEngineMessageCtx; |
103 |
110 |
104 void (*onCfgSchemeCb)(void *context, flib_cfg *scheme); |
111 void (*onCfgSchemeCb)(void *context, flib_cfg *scheme); |
105 void *onCfgSchemeCtx; |
112 void *onCfgSchemeCtx; |
106 |
113 |
121 |
128 |
122 bool running; |
129 bool running; |
123 bool destroyRequested; |
130 bool destroyRequested; |
124 }; |
131 }; |
125 |
132 |
126 void clearCallbacks(flib_netconn *conn); |
133 void netconn_clearCallbacks(flib_netconn *conn); |
|
134 void netconn_leaveRoom(flib_netconn *conn); |
|
135 void netconn_setMap(flib_netconn *conn, const flib_map *map); |
|
136 void netconn_setWeaponset(flib_netconn *conn, const flib_weaponset *weaponset); |
|
137 void netconn_setScript(flib_netconn *conn, const char *script); |
|
138 void netconn_setScheme(flib_netconn *conn, const flib_cfg *scheme); |
127 |
139 |
128 #endif |
140 #endif |