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.1.1.1 by root, Fri Feb 3 07:14:43 2006 UTC vs.
Revision 1.1.1.2 by elmex, Wed Feb 22 18:03:28 2006 UTC

1/* 1/*
2 * static char *rcsid_sock_info_c = 2 * static char *rcsid_sock_info_c =
3 * "$Id: info.c,v 1.1.1.1 2006/02/03 07:14:43 root Exp $"; 3 * "$Id: info.c,v 1.1.1.2 2006/02/22 18:03:28 elmex Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
88 * If pl is NULL or without contr set, writes message to log. 88 * If pl is NULL or without contr set, writes message to log.
89 * 89 *
90 * Else sends message to player via esrv_print_msg 90 * Else sends message to player via esrv_print_msg
91 */ 91 */
92 92
93static void print_message(int colr, object *pl,const char *tmp) { 93static void print_message(int colr, const object *pl, const char *tmp) {
94 94
95 if(tmp == (char *) NULL) { 95 if(tmp == (char *) NULL) {
96 tmp="[NULL]"; 96 tmp="[NULL]";
97 } 97 }
98 98
110/** 110/**
111 * Prints out the contents of specified buffer structures, 111 * Prints out the contents of specified buffer structures,
112 * and clears the string. 112 * and clears the string.
113 */ 113 */
114 114
115void flush_output_element(object *pl, Output_Buf *outputs) 115void flush_output_element(const object *pl, Output_Buf *outputs)
116{ 116{
117 char tbuf[MAX_BUF]; 117 char tbuf[MAX_BUF];
118 118
119 if (outputs->buf==NULL) return; 119 if (outputs->buf==NULL) return;
120 snprintf(tbuf,MAX_BUF, "%d times %s", outputs->count, outputs->buf); 120 snprintf(tbuf,MAX_BUF, "%d times %s", outputs->count, outputs->buf);
137 * 137 *
138 * If message not already in buffers, flushes olders buffer, 138 * If message not already in buffers, flushes olders buffer,
139 * and adds message to queue. 139 * and adds message to queue.
140 */ 140 */
141 141
142void check_output_buffers(object *pl, const char *buf) 142static void check_output_buffers(const object *pl, const char *buf)
143{ 143{
144 int i, oldest=0; 144 int i, oldest=0;
145 145
146 if (pl->contr->outputs_count<2) { 146 if (pl->contr->outputs_count<2) {
147 print_message(NDI_BLACK, pl, buf); 147 print_message(NDI_BLACK, pl, buf);
192 * 192 *
193 * If message is black, and not NDI_UNIQUE, gets sent through output buffers. 193 * If message is black, and not NDI_UNIQUE, gets sent through output buffers.
194 * 194 *
195 */ 195 */
196 196
197void new_draw_info(int flags,int pri, object *pl, const char *buf) 197void new_draw_info(int flags, int pri, const object *pl, const char *buf)
198{ 198{
199 199
200 if (flags & NDI_ALL) { 200 if (flags & NDI_ALL) {
201 player *tmppl; 201 player *tmppl;
202 int i; 202 int i;
238 * formatting, so instead of the calling function having to do it, we do 238 * formatting, so instead of the calling function having to do it, we do
239 * it here. It may also have advantages in the future for reduction of 239 * it here. It may also have advantages in the future for reduction of
240 * client/server bandwidth (client could keep track of various strings 240 * client/server bandwidth (client could keep track of various strings
241 */ 241 */
242 242
243void new_draw_info_format(int flags, int pri,object *pl, const char *format, ...) 243void new_draw_info_format(int flags, int pri, const object *pl, const char *format, ...)
244{ 244{
245 char buf[HUGE_BUF]; 245 char buf[HUGE_BUF];
246 246
247 va_list ap; 247 va_list ap;
248 va_start(ap, format); 248 va_start(ap, format);
254 new_draw_info(flags, pri, pl, buf); 254 new_draw_info(flags, pri, pl, buf);
255} 255}
256 256
257 257
258void draw_ext_info( 258void draw_ext_info(
259 int flags, int pri, object *pl, uint8 type, 259 int flags, int pri, const object *pl, uint8 type,
260 uint8 subtype, const char* message, const char* oldmessage){ 260 uint8 subtype, const char* message, const char* oldmessage){
261 261
262 if(!pl || (pl->type!=PLAYER) || (pl->contr==NULL)) 262 if(!pl || (pl->type!=PLAYER) || (pl->contr==NULL))
263 return; 263 return;
264 264
277 esrv_print_ext_msg(&pl->contr->socket,flags&NDI_COLOR_MASK,type,subtype,message); 277 esrv_print_ext_msg(&pl->contr->socket,flags&NDI_COLOR_MASK,type,subtype,message);
278 } 278 }
279} 279}
280 280
281void draw_ext_info_format( 281void draw_ext_info_format(
282 int flags, int pri, object *pl, uint8 type, 282 int flags, int pri, const object *pl, uint8 type,
283 uint8 subtype, const char* old_format, 283 uint8 subtype, const char* old_format,
284 char* new_format, ...){ 284 char* new_format, ...){
285 285
286 char buf[HUGE_BUF]; 286 char buf[HUGE_BUF];
287 if(!pl || (pl->type!=PLAYER) || (pl->contr==NULL)) 287 if(!pl || (pl->type!=PLAYER) || (pl->contr==NULL))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines