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.10 by root, Tue Sep 19 10:21:58 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 *
688 int i; 674 int i;
689 size_t len; 675 size_t len;
690 char buf[MAX_BUF]; 676 char buf[MAX_BUF];
691 677
692 if (With != NULL) 678 if (With != NULL)
693 {
694 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);
695 }
696 else 680 else
697 {
698 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);
699 } 682
700 len = strlen (buf); 683 len = strlen (buf);
701 for (i = 1; i < socket_info.allocated_sockets; i++)
702 {
703 if (init_sockets[i].old_mode == Old_Listen)
704 {
705 cs_write_string (&init_sockets[i], buf, len);
706 }
707 }
708} 684}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines