ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/client.h
(Generate patch)

Comparing deliantra/server/include/client.h (file contents):
Revision 1.90 by root, Sat Nov 7 18:30:05 2009 UTC vs.
Revision 1.94 by root, Tue Apr 6 21:11:48 2010 UTC

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.
20 * The authors can be reached via e-mail to <support@deliantra.net> 20 * The authors can be reached via e-mail to <support@deliantra.net>
21 */ 21 */
22 22
23#ifndef CLIENT_H 23#ifndef CLIENT_H
24#define CLIENT_H 24#define CLIENT_H
25
26#include <deque>
27#include <bitset>
28#include <tr1/unordered_set>
29 25
30#if HAVE_TCP_INFO 26#if HAVE_TCP_INFO
31# include <netinet/tcp.h> 27# include <netinet/tcp.h>
32#else 28#else
33 struct tcp_info { 29 struct tcp_info {
185 bool ACC (RW, newmapcmd); /* Send newmap command when entering new map SMACFIGGEN */ 181 bool ACC (RW, newmapcmd); /* Send newmap command when entering new map SMACFIGGEN */
186 bool ACC (RW, plugincmd); // extend the protocol through a plug-in */ 182 bool ACC (RW, plugincmd); // extend the protocol through a plug-in */
187 bool ACC (RW, mapinfocmd); // return map info and send map change info 183 bool ACC (RW, mapinfocmd); // return map info and send map change info
188 uint8_t ACC (RW, extcmd); // call into extensions/plugins 184 uint8_t ACC (RW, extcmd); // call into extensions/plugins
189 bool ACC (RW, update_look); /* If true, we need to send the look window */ 185 bool ACC (RW, update_look); /* If true, we need to send the look window */
186 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 */ 187 bool ACC (RW, has_readable_type); /* If true client accept additional text information */
191 /* used to arrange text in books, scrolls, or scripted dialogs */ 188 /* 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 */ 189 bool ACC (RW, monitor_spells); /* Client wishes to be informed when their spell list changes */
193 bool ACC (RW, smoothing); // deliantra-style smoothing 190 bool ACC (RW, smoothing); // deliantra-style smoothing
194 191
257 int len; 254 int len;
258 int count; 255 int count;
259 char msg[MSG_BUF_SIZE]; 256 char msg[MSG_BUF_SIZE];
260 } msgbuf[MSG_BUF_COUNT]; 257 } msgbuf[MSG_BUF_COUNT];
261 258
262 MTH bool msg_suppressed (const char *msg); 259 MTH bool msg_suppressed (const_utf8_string msg);
263 260
264 /* The following is the setup for a ring buffer for storing output 261 /* The following is the setup for a ring buffer for storing output
265 * data that the OS can't handle right away. 262 * data that the OS can't handle right away.
266 * TODO: this member is enourmously large - optimise? 263 * TODO: this member is enourmously large - optimise?
267 */ 264 */
289 MTH void flush (); 286 MTH void flush ();
290 MTH void write_outputbuffer (); 287 MTH void write_outputbuffer ();
291 MTH int outputbuffer_len () const { return outputbuffer.len; } 288 MTH int outputbuffer_len () const { return outputbuffer.len; }
292 void send (void *buf_, int len); 289 void send (void *buf_, int len);
293 290
294 void send_packet (const char *buf); 291 void send_packet (const_octet_string buf);
295 void send_packet (const char *buf, int len); 292 void send_packet (const_octet_string buf, int len);
296 void send_packet_printf (const char *format, ...) attribute ((format (printf, 2, 3))); 293 void send_packet_printf (const_utf8_string format, ...) attribute ((format (printf, 2, 3)));
297 void send_packet (packet &sl); 294 void send_packet (packet &sl);
298 295
299 void send_drawinfo (const char *msg, int flags = NDI_BLACK); 296 void send_drawinfo (const_utf8_string msg, int flags = NDI_BLACK);
300 297
301 MTH void send_face (faceidx facenum, int pri = 0); 298 MTH void send_face (faceidx facenum, int pri = 0);
302 MTH void send_faces (object *ob); 299 MTH void send_faces (object *ob);
303 MTH void send_animation (short anim_num); 300 MTH void send_animation (short anim_num);
304 void send_msg (int color, const char *type, const char *msg); 301 void send_msg (int color, const_utf8_string type, const_utf8_string msg);
305 302
306 MTH void play_sound (faceidx sound, int dx = 0, int dy = 0); 303 MTH void play_sound (faceidx sound, int dx = 0, int dy = 0);
307 // called when something under the player changes 304 // called when something under the player changes
308 MTH void floorbox_update () { update_look = 1; } 305 MTH void floorbox_update () { update_look = 1; }
309 // called when the player has been moved 306 // called when the player has been moved
377 for (int _i = 0; _i < clients.size (); ++_i) \ 374 for (int _i = 0; _i < clients.size (); ++_i) \
378 statementvar (client *, var, clients [_i]) 375 statementvar (client *, var, clients [_i])
379 376
380// returns true when the message needs special (read: perl) treatment 377// returns true when the message needs special (read: perl) treatment
381static inline bool 378static inline bool
382msg_is_special (const char *msg, bool nl_special = true) 379msg_is_special (const_any_string msg, bool nl_special = true)
383{ 380{
384 return msg [strcspn (msg, nl_special ? "<&\n" : "<&")]; 381 return msg [strcspn (msg, nl_special ? "<&\n" : "<&")];
385} 382}
386 383
387#endif 384#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines