… | |
… | |
62 | int tcpi_advmss; |
62 | int tcpi_advmss; |
63 | int tcpi_reordering; |
63 | int tcpi_reordering; |
64 | }; |
64 | }; |
65 | #endif |
65 | #endif |
66 | |
66 | |
|
|
67 | //+GPL |
|
|
68 | |
67 | // (possibly) max. number of objects "per page" in the ground container |
69 | // (possibly) max. number of objects "per page" in the ground container |
68 | #define FLOORBOX_PAGESIZE 50 |
70 | #define FLOORBOX_PAGESIZE 50 |
69 | |
71 | |
70 | struct MapCell |
72 | struct MapCell |
71 | { |
73 | { |
… | |
… | |
144 | tstamp stamp; |
146 | tstamp stamp; |
145 | const packet_type *handler; |
147 | const packet_type *handler; |
146 | char *data; |
148 | char *data; |
147 | int datalen; |
149 | int datalen; |
148 | }; |
150 | }; |
|
|
151 | |
|
|
152 | //-GPL |
149 | |
153 | |
150 | /* how many times we are allowed to give the wrong password before being kicked. */ |
154 | /* how many times we are allowed to give the wrong password before being kicked. */ |
151 | #define MAX_PASSWORD_FAILURES 5 |
155 | #define MAX_PASSWORD_FAILURES 5 |
152 | |
156 | |
153 | INTERFACE_CLASS (client) // should become player when newsocket is a baseclass of player |
157 | INTERFACE_CLASS (client) // should become player when newsocket is a baseclass of player |
… | |
… | |
181 | bool ACC (RW, newmapcmd); /* Send newmap command when entering new map SMACFIGGEN */ |
185 | bool ACC (RW, newmapcmd); /* Send newmap command when entering new map SMACFIGGEN */ |
182 | bool ACC (RW, plugincmd); // extend the protocol through a plug-in */ |
186 | bool ACC (RW, plugincmd); // extend the protocol through a plug-in */ |
183 | bool ACC (RW, mapinfocmd); // return map info and send map change info |
187 | bool ACC (RW, mapinfocmd); // return map info and send map change info |
184 | uint8_t ACC (RW, extcmd); // call into extensions/plugins |
188 | uint8_t ACC (RW, extcmd); // call into extensions/plugins |
185 | bool ACC (RW, update_look); /* If true, we need to send the look window */ |
189 | bool ACC (RW, update_look); /* If true, we need to send the look window */ |
|
|
190 | bool ACC (RW, update_spells); // If true, we need to esrv_update_spells |
186 | bool ACC (RW, has_readable_type); /* If true client accept additional text information */ |
191 | bool ACC (RW, has_readable_type); /* If true client accept additional text information */ |
187 | /* used to arrange text in books, scrolls, or scripted dialogs */ |
192 | /* used to arrange text in books, scrolls, or scripted dialogs */ |
188 | bool ACC (RW, monitor_spells); /* Client wishes to be informed when their spell list changes */ |
193 | bool ACC (RW, monitor_spells); /* Client wishes to be informed when their spell list changes */ |
189 | bool ACC (RW, smoothing); // deliantra-style smoothing |
194 | bool ACC (RW, smoothing); // deliantra-style smoothing |
190 | |
195 | |
… | |
… | |
253 | int len; |
258 | int len; |
254 | int count; |
259 | int count; |
255 | char msg[MSG_BUF_SIZE]; |
260 | char msg[MSG_BUF_SIZE]; |
256 | } msgbuf[MSG_BUF_COUNT]; |
261 | } msgbuf[MSG_BUF_COUNT]; |
257 | |
262 | |
258 | MTH bool msg_suppressed (const char *msg); |
263 | MTH bool msg_suppressed (const_utf8_string msg); |
259 | |
264 | |
260 | /* The following is the setup for a ring buffer for storing output |
265 | /* The following is the setup for a ring buffer for storing output |
261 | * data that the OS can't handle right away. |
266 | * data that the OS can't handle right away. |
262 | * TODO: this member is enourmously large - optimise? |
267 | * TODO: this member is enourmously large - optimise? |
263 | */ |
268 | */ |
… | |
… | |
285 | MTH void flush (); |
290 | MTH void flush (); |
286 | MTH void write_outputbuffer (); |
291 | MTH void write_outputbuffer (); |
287 | MTH int outputbuffer_len () const { return outputbuffer.len; } |
292 | MTH int outputbuffer_len () const { return outputbuffer.len; } |
288 | void send (void *buf_, int len); |
293 | void send (void *buf_, int len); |
289 | |
294 | |
290 | void send_packet (const char *buf); |
295 | void send_packet (const_octet_string buf); |
291 | void send_packet (const char *buf, int len); |
296 | void send_packet (const_octet_string buf, int len); |
292 | void send_packet_printf (const char *format, ...); |
297 | void send_packet_printf (const_utf8_string format, ...) attribute ((format (printf, 2, 3))); |
293 | void send_packet (packet &sl); |
298 | void send_packet (packet &sl); |
294 | |
299 | |
295 | void send_drawinfo (const char *msg, int flags = NDI_BLACK); |
300 | void send_drawinfo (const_utf8_string msg, int flags = NDI_BLACK); |
296 | |
301 | |
297 | MTH void send_face (faceidx facenum, int pri = 0); |
302 | MTH void send_face (faceidx facenum, int pri = 0); |
298 | MTH void send_faces (object *ob); |
303 | MTH void send_faces (object *ob); |
299 | MTH void send_animation (short anim_num); |
304 | MTH void send_animation (short anim_num); |
300 | void send_msg (int color, const char *type, const char *msg); |
305 | void send_msg (int color, const_utf8_string type, const_utf8_string msg); |
301 | |
306 | |
302 | MTH void play_sound (faceidx sound, int dx = 0, int dy = 0); |
307 | MTH void play_sound (faceidx sound, int dx = 0, int dy = 0); |
303 | // called when something under the player changes |
308 | // called when something under the player changes |
304 | MTH void floorbox_update () { update_look = 1; } |
309 | MTH void floorbox_update () { update_look = 1; } |
305 | // called when the player has been moved |
310 | // called when the player has been moved |
… | |
… | |
346 | ACC (RW, tcpi.tcpi_snd_cwnd); |
351 | ACC (RW, tcpi.tcpi_snd_cwnd); |
347 | ACC (RW, tcpi.tcpi_advmss); |
352 | ACC (RW, tcpi.tcpi_advmss); |
348 | ACC (RW, tcpi.tcpi_reordering); |
353 | ACC (RW, tcpi.tcpi_reordering); |
349 | #endif |
354 | #endif |
350 | |
355 | |
|
|
356 | //+GPL |
|
|
357 | |
351 | #define CLIENT_SUPPORT_READABLES(__sockPtr,__type)\ |
358 | #define CLIENT_SUPPORT_READABLES(__sockPtr,__type)\ |
352 | ( ((__type)>0) &&\ |
359 | ( ((__type)>0) &&\ |
353 | ((__sockPtr)->has_readable_type) && \ |
360 | ((__sockPtr)->has_readable_type) && \ |
354 | ((__sockPtr)->supported_readables & (1<<(__type))) ) |
361 | ((__sockPtr)->supported_readables & (1<<(__type))) ) |
355 | |
362 | |
… | |
… | |
359 | #define VERSION_CS 1023 /* version >= 1023 understand setup cmd */ |
366 | #define VERSION_CS 1023 /* version >= 1023 understand setup cmd */ |
360 | #define VERSION_SC 1026 |
367 | #define VERSION_SC 1026 |
361 | //#define VERSION_SC 1027 // requestinfo image_info and image_sums, makes extending faces on the fly impossible |
368 | //#define VERSION_SC 1027 // requestinfo image_info and image_sums, makes extending faces on the fly impossible |
362 | #define VERSION_INFO "Deliantra Server" |
369 | #define VERSION_INFO "Deliantra Server" |
363 | |
370 | |
|
|
371 | //-GPL |
|
|
372 | |
364 | typedef object_vector<client, &client::active> sockvec; |
373 | typedef object_vector<client, &client::active> sockvec; |
365 | |
374 | |
366 | extern sockvec clients; |
375 | extern sockvec clients; |
367 | |
376 | |
368 | #define for_all_clients(var) \ |
377 | #define for_all_clients(var) \ |
369 | for (int _i = 0; _i < clients.size (); ++_i) \ |
378 | for (int _i = 0; _i < clients.size (); ++_i) \ |
370 | statementvar (client *, var, clients [_i]) |
379 | statementvar (client *, var, clients [_i]) |
371 | |
380 | |
372 | // returns true when the message needs special (read: perl) treatment |
381 | // returns true when the message needs special (read: perl) treatment |
373 | static inline bool |
382 | static inline bool |
374 | msg_is_special (const char *msg, bool nl_special = true) |
383 | msg_is_special (const_any_string msg, bool nl_special = true) |
375 | { |
384 | { |
376 | return msg [strcspn (msg, nl_special ? "<&\n" : "<&")]; |
385 | return msg [strcspn (msg, nl_special ? "<&\n" : "<&")]; |
377 | } |
386 | } |
378 | |
387 | |
379 | #endif |
388 | #endif |