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.8 by root, Tue Sep 19 09:38:32 2006 UTC vs.
Revision 1.11 by root, Wed Sep 20 21:53:50 2006 UTC

96 96
97static void 97static void
98print_message (int colr, const object *pl, const char *tmp) 98print_message (int colr, const object *pl, const char *tmp)
99{ 99{
100 100
101 if (tmp == (char *) NULL) 101 if (!tmp)
102 {
103 tmp = "[NULL]"; 102 tmp = "[NULL]";
104 }
105 103
106 if (!pl || (pl->type == PLAYER && pl->contr == NULL)) 104 if (!pl || (pl->type == PLAYER && pl->contr == NULL))
107 return; 105 return;
108 106
109 if (pl->type == PLAYER) 107 if (pl->type == PLAYER)
110 { 108 {
111 esrv_print_msg (&pl->contr->socket, colr, (char *) tmp); 109 esrv_print_msg (&pl->contr->socket, colr, (char *) tmp);
112 return; 110 return;
113 } 111 }
114} 112}
115
116 113
117/** 114/**
118 * Prints out the contents of specified buffer structures, 115 * Prints out the contents of specified buffer structures,
119 * and clears the string. 116 * and clears the string.
120 */ 117 */
222 int i; 219 int i;
223 220
224 for (tmppl = first_player; tmppl != NULL; tmppl = tmppl->next) 221 for (tmppl = first_player; tmppl != NULL; tmppl = tmppl->next)
225 new_draw_info ((flags & ~NDI_ALL), pri, tmppl->ob, buf); 222 new_draw_info ((flags & ~NDI_ALL), pri, tmppl->ob, buf);
226 223
227 for (i = 1; i < socket_info.allocated_sockets; i++)
228 {
229 if (init_sockets[i].status == Ns_Old && init_sockets[i].old_mode != Old_Listen && pri < 10)
230 {
231 cs_write_string (&init_sockets[i], buf, strlen (buf));
232 /* Most messages don't have a newline, so add one */
233 cs_write_string (&init_sockets[i], "\n", 1);
234 }
235 }
236
237 return; 224 return;
238 } 225 }
226
239 if (!pl || (pl->type == PLAYER && pl->contr == NULL)) 227 if (!pl || (pl->type == PLAYER && pl->contr == NULL))
240 { 228 {
241 /* Write to the socket? */ 229 /* Write to the socket? */
242 print_message (0, NULL, buf); 230 print_message (0, NULL, buf);
243 return; 231 return;
244 } 232 }
233
245 if (pl->type != PLAYER) 234 if (pl->type != PLAYER)
246 return; 235 return;
236
247 if (pri >= pl->contr->listening) 237 if (pri >= pl->contr->listening)
248 return; 238 return;
249 239
250 if ((flags & NDI_COLOR_MASK) == NDI_BLACK && !(flags & NDI_UNIQUE)) 240 if ((flags & NDI_COLOR_MASK) == NDI_BLACK && !(flags & NDI_UNIQUE))
251 {
252 /* following prints stuff out, as appropriate */ 241 /* following prints stuff out, as appropriate */
253 check_output_buffers (pl, buf); 242 check_output_buffers (pl, buf);
254 }
255 else 243 else
256 {
257 print_message (flags & NDI_COLOR_MASK, pl, buf); 244 print_message (flags & NDI_COLOR_MASK, pl, buf);
258 }
259} 245}
260 246
261/** 247/**
262 * Wrapper for new_draw_info printf-like. 248 * Wrapper for new_draw_info printf-like.
263 * 249 *
423 object *op; 409 object *op;
424 410
425 for (op = pl->inv; op; op = op->below) 411 for (op = pl->inv; op; op = op->below)
426 if (op->type == BOW && QUERY_FLAG (op, FLAG_APPLIED)) 412 if (op->type == BOW && QUERY_FLAG (op, FLAG_APPLIED))
427 break; 413 break;
414
428 if (op == NULL) 415 if (op == NULL)
429 break; 416 break;
430 417
431 sprintf (obuf, "Range: %s (%s)", query_base_name (op, 0), op->race ? (const char *) op->race : "nothing"); 418 sprintf (obuf, "Range: %s (%s)", query_base_name (op, 0), op->race ? (const char *) op->race : "nothing");
432 } 419 }
436 if (settings.casting_time == TRUE) 423 if (settings.casting_time == TRUE)
437 { 424 {
438 if (pl->casting_time > -1) 425 if (pl->casting_time > -1)
439 { 426 {
440 if (pl->casting_time == 0) 427 if (pl->casting_time == 0)
441 sprintf (obuf, "Range: Holding spell (%s)", (const char *) pl->spell->name); 428 sprintf (obuf, "Range: Holding spell (%s)", &pl->spell->name);
442 else 429 else
443 sprintf (obuf, "Range: Casting spell (%s)", (const char *) pl->spell->name); 430 sprintf (obuf, "Range: Casting spell (%s)", &pl->spell->name);
444 } 431 }
445 else 432 else
446 sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); 433 sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name);
447 } 434 }
448 else 435 else
687 int i; 674 int i;
688 size_t len; 675 size_t len;
689 char buf[MAX_BUF]; 676 char buf[MAX_BUF];
690 677
691 if (With != NULL) 678 if (With != NULL)
692 {
693 snprintf (buf, MAX_BUF, "%s\t%s\t%d\t%s\t%d\n", Who, What, WhatType, With, WithType); 679 snprintf (buf, MAX_BUF, "%s\t%s\t%d\t%s\t%d\n", Who, What, WhatType, With, WithType);
694 }
695 else 680 else
696 {
697 snprintf (buf, MAX_BUF, "%s\t%s\t%d\n", Who, What, WhatType); 681 snprintf (buf, MAX_BUF, "%s\t%s\t%d\n", Who, What, WhatType);
698 } 682
699 len = strlen (buf); 683 len = strlen (buf);
700 for (i = 1; i < socket_info.allocated_sockets; i++)
701 {
702 if (init_sockets[i].old_mode == Old_Listen)
703 {
704 cs_write_string (&init_sockets[i], buf, len);
705 }
706 }
707} 684}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines