1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * |
5 | * |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
7 | * the terms of the Affero GNU General Public License as published by the |
7 | * the terms of the Affero GNU General Public License as published by the |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
9 | * option) any later version. |
9 | * option) any later version. |
… | |
… | |
185 | 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 */ |
186 | bool ACC (RW, plugincmd); // extend the protocol through a plug-in */ |
186 | bool ACC (RW, plugincmd); // extend the protocol through a plug-in */ |
187 | 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 |
188 | uint8_t ACC (RW, extcmd); // call into extensions/plugins |
188 | uint8_t ACC (RW, extcmd); // call into extensions/plugins |
189 | 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 |
190 | 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 */ |
191 | /* used to arrange text in books, scrolls, or scripted dialogs */ |
192 | /* used to arrange text in books, scrolls, or scripted dialogs */ |
192 | 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 */ |
193 | bool ACC (RW, smoothing); // deliantra-style smoothing |
194 | bool ACC (RW, smoothing); // deliantra-style smoothing |
194 | |
195 | |
… | |
… | |
257 | int len; |
258 | int len; |
258 | int count; |
259 | int count; |
259 | char msg[MSG_BUF_SIZE]; |
260 | char msg[MSG_BUF_SIZE]; |
260 | } msgbuf[MSG_BUF_COUNT]; |
261 | } msgbuf[MSG_BUF_COUNT]; |
261 | |
262 | |
262 | MTH bool msg_suppressed (const char *msg); |
263 | MTH bool msg_suppressed (const_utf8_string msg); |
263 | |
264 | |
264 | /* 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 |
265 | * data that the OS can't handle right away. |
266 | * data that the OS can't handle right away. |
266 | * TODO: this member is enourmously large - optimise? |
267 | * TODO: this member is enourmously large - optimise? |
267 | */ |
268 | */ |
… | |
… | |
289 | MTH void flush (); |
290 | MTH void flush (); |
290 | MTH void write_outputbuffer (); |
291 | MTH void write_outputbuffer (); |
291 | MTH int outputbuffer_len () const { return outputbuffer.len; } |
292 | MTH int outputbuffer_len () const { return outputbuffer.len; } |
292 | void send (void *buf_, int len); |
293 | void send (void *buf_, int len); |
293 | |
294 | |
294 | void send_packet (const char *buf); |
295 | void send_packet (const_octet_string buf); |
295 | void send_packet (const char *buf, int len); |
296 | void send_packet (const_octet_string buf, int len); |
296 | void send_packet_printf (const char *format, ...); |
297 | void send_packet_printf (const_utf8_string format, ...) attribute ((format (printf, 2, 3))); |
297 | void send_packet (packet &sl); |
298 | void send_packet (packet &sl); |
298 | |
299 | |
299 | void send_drawinfo (const char *msg, int flags = NDI_BLACK); |
300 | void send_drawinfo (const_utf8_string msg, int flags = NDI_BLACK); |
300 | |
301 | |
301 | MTH void send_face (faceidx facenum, int pri = 0); |
302 | MTH void send_face (faceidx facenum, int pri = 0); |
302 | MTH void send_faces (object *ob); |
303 | MTH void send_faces (object *ob); |
303 | MTH void send_animation (short anim_num); |
304 | MTH void send_animation (short anim_num); |
304 | 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); |
305 | |
306 | |
306 | 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); |
307 | // called when something under the player changes |
308 | // called when something under the player changes |
308 | MTH void floorbox_update () { update_look = 1; } |
309 | MTH void floorbox_update () { update_look = 1; } |
309 | // called when the player has been moved |
310 | // called when the player has been moved |
… | |
… | |
377 | for (int _i = 0; _i < clients.size (); ++_i) \ |
378 | for (int _i = 0; _i < clients.size (); ++_i) \ |
378 | statementvar (client *, var, clients [_i]) |
379 | statementvar (client *, var, clients [_i]) |
379 | |
380 | |
380 | // returns true when the message needs special (read: perl) treatment |
381 | // returns true when the message needs special (read: perl) treatment |
381 | static inline bool |
382 | static inline bool |
382 | msg_is_special (const char *msg, bool nl_special = true) |
383 | msg_is_special (const_any_string msg, bool nl_special = true) |
383 | { |
384 | { |
384 | return msg [strcspn (msg, nl_special ? "<&\n" : "<&")]; |
385 | return msg [strcspn (msg, nl_special ? "<&\n" : "<&")]; |
385 | } |
386 | } |
386 | |
387 | |
387 | #endif |
388 | #endif |