ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/info.C
(Generate patch)

Comparing deliantra/server/socket/info.C (file contents):
Revision 1.16 by root, Thu Dec 14 02:37:37 2006 UTC vs.
Revision 1.18 by root, Thu Dec 14 05:09:32 2006 UTC

46 */ 46 */
47static void 47static void
48esrv_print_msg (client_socket * ns, int color, const char *str) 48esrv_print_msg (client_socket * ns, int color, const char *str)
49{ 49{
50 packet sl; 50 packet sl;
51
52 if (ns->status == Ns_Old)
53 sl.printf ("%s\n", str);
54 else
55 sl.printf ("drawinfo %d %s", color, str); 51 sl.printf ("drawinfo %d %s", color, str);
56
57 ns->send_packet (sl); 52 ns->send_packet (sl);
58} 53}
59 54
60/** 55/**
61 * Draws an extended message on the client. 56 * Draws an extended message on the client.
95 90
96 if (!pl || (pl->type == PLAYER && pl->contr == NULL)) 91 if (!pl || (pl->type == PLAYER && pl->contr == NULL))
97 return; 92 return;
98 93
99 if (pl->type == PLAYER) 94 if (pl->type == PLAYER)
100 {
101 esrv_print_msg (&pl->contr->socket, colr, (char *) tmp); 95 esrv_print_msg (pl->contr->socket, colr, (char *) tmp);
102 return;
103 }
104} 96}
105 97
106/** 98/**
107 * Prints out the contents of specified buffer structures, 99 * Prints out the contents of specified buffer structures,
108 * and clears the string. 100 * and clears the string.
268 if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) 260 if (!pl || (pl->type != PLAYER) || (pl->contr == NULL))
269 return; 261 return;
270 262
271 if (pri >= pl->contr->listening) 263 if (pri >= pl->contr->listening)
272 return; 264 return;
265
273 if (!CLIENT_SUPPORT_READABLES (&pl->contr->socket, type)) 266 if (!CLIENT_SUPPORT_READABLES (pl->contr->socket, type))
274 { 267 {
275 char *buf = (char *) malloc (strlen (oldmessage == NULL ? message : oldmessage) + 1); 268 char *buf = (char *) malloc (strlen (oldmessage == NULL ? message : oldmessage) + 1);
276 269
277 if (buf == NULL) 270 if (buf == NULL)
278 LOG (llevError, "info::draw_ext_info -> Out of memory!"); 271 LOG (llevError, "info::draw_ext_info -> Out of memory!");
283 new_draw_info (flags, pri, pl, buf); 276 new_draw_info (flags, pri, pl, buf);
284 free (buf); 277 free (buf);
285 } 278 }
286 } 279 }
287 else 280 else
288 {
289 esrv_print_ext_msg (&pl->contr->socket, flags & NDI_COLOR_MASK, type, subtype, message); 281 esrv_print_ext_msg (pl->contr->socket, flags & NDI_COLOR_MASK, type, subtype, message);
290 }
291} 282}
292 283
293void 284void
294draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) 285draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...)
295{ 286{
299 if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) 290 if (!pl || (pl->type != PLAYER) || (pl->contr == NULL))
300 return; 291 return;
301 292
302 if (pri >= pl->contr->listening) 293 if (pri >= pl->contr->listening)
303 return; 294 return;
295
304 if (!CLIENT_SUPPORT_READABLES (&pl->contr->socket, type)) 296 if (!CLIENT_SUPPORT_READABLES (pl->contr->socket, type))
305 { 297 {
306 va_list ap; 298 va_list ap;
307 299
308 LOG (llevDebug, "Non supported extension text type for client.\n"); 300 LOG (llevDebug, "Non supported extension text type for client.\n");
309 va_start (ap, new_format); 301 va_start (ap, new_format);
318 310
319 va_start (ap, new_format); 311 va_start (ap, new_format);
320 vsnprintf (buf, HUGE_BUF, new_format, ap); 312 vsnprintf (buf, HUGE_BUF, new_format, ap);
321 va_end (ap); 313 va_end (ap);
322 strip_media_tag (buf); 314 strip_media_tag (buf);
323 esrv_print_ext_msg (&pl->contr->socket, flags & NDI_COLOR_MASK, type, subtype, buf); 315 esrv_print_ext_msg (pl->contr->socket, flags & NDI_COLOR_MASK, type, subtype, buf);
324 } 316 }
325} 317}
326 318
327/** 319/**
328 * Writes to everyone on the map *except* op. This is useful for emotions. 320 * Writes to everyone on the map *except* op. This is useful for emotions.
637 629
638 for (int y = ymin; y <= ymax; y++) 630 for (int y = ymin; y <= ymax; y++)
639 for (int x = xmin; x <= xmax; x++) 631 for (int x = xmin; x <= xmax; x++)
640 sl << uint8 (map_mark[x + MAGIC_MAP_SIZE * y] & ~FACE_FLOOR); 632 sl << uint8 (map_mark[x + MAGIC_MAP_SIZE * y] & ~FACE_FLOOR);
641 633
642 Send_With_Handling (&pl->contr->socket, &sl); 634 Send_With_Handling (pl->contr->socket, &sl);
643
644 635
645 free (map_mark); 636 free (map_mark);
646} 637}
647 638
648 639

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines