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.38 by root, Wed Apr 25 18:47:51 2007 UTC vs.
Revision 1.41 by root, Thu May 3 10:39:46 2007 UTC

150 * 150 *
151 * If message is black, and not NDI_UNIQUE, gets sent through output buffers. 151 * If message is black, and not NDI_UNIQUE, gets sent through output buffers.
152 * 152 *
153 */ 153 */
154void 154void
155new_draw_info (int flags, int pri, const object *pl, const char *buf) 155new_draw_info (int flags, int pri, const object *op, const char *buf)
156{ 156{
157 if (flags & NDI_ALL) 157 if (flags & NDI_ALL)
158 {
159 for_all_players (pl) 158 for_all_players (pl)
160 new_draw_info (flags & ~NDI_ALL, pri, pl->ob, buf); 159 new_draw_info (flags & ~NDI_ALL, pri, pl->ob, buf);
161 160 else
161 {
162 if (!op || !op->contr || !op->contr->ns)
162 return; 163 return;
163 }
164 164
165 if (!pl || pl->type != PLAYER || !pl->contr || !pl->contr->ns)
166 return;
167
168 if (pri >= pl->contr->listening) 165 if (pri >= op->contr->listening)
169 return; 166 return;
170 167
171 if ((flags & (NDI_COLOR_MASK | NDI_UNIQUE)) != NDI_BLACK 168 if ((flags & (NDI_COLOR_MASK | NDI_UNIQUE)) != NDI_BLACK
172 || !pl->contr->ns->msg_suppressed (buf)) 169 || !op->contr->ns->msg_suppressed (buf))
173 print_message (flags & NDI_COLOR_MASK, pl, buf); 170 print_message (flags & NDI_COLOR_MASK, op, buf);
171 }
174} 172}
175 173
176/** 174/**
177 * Wrapper for new_draw_info printf-like. 175 * Wrapper for new_draw_info printf-like.
178 * 176 *
298 * to handle this 296 * to handle this
299 */ 297 */
300void 298void
301clear_win_info (object *op) 299clear_win_info (object *op)
302{ 300{
303}
304
305/**
306 * Get player's current range attack in obuf.
307 */
308void
309rangetostring (object *pl, char *obuf)
310{
311 switch (pl->contr->shoottype)
312 {
313 case range_none:
314 strcpy (obuf, "Range: nothing");
315 break;
316
317 case range_bow:
318 {
319 object *op;
320
321 for (op = pl->inv; op; op = op->below)
322 if (op->type == BOW && QUERY_FLAG (op, FLAG_APPLIED))
323 break;
324
325 if (op == NULL)
326 break;
327
328 sprintf (obuf, "Range: %s (%s)", query_base_name (op, 0), op->race ? (const char *) op->race : "nothing");
329 }
330 break;
331
332 case range_magic:
333 if (settings.casting_time == TRUE)
334 {
335 if (pl->casting_time > -1)
336 {
337 if (pl->casting_time == 0)
338 sprintf (obuf, "Range: Holding spell (%s)", &pl->spell->name);
339 else
340 sprintf (obuf, "Range: Casting spell (%s)", &pl->spell->name);
341 }
342 else
343 sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name);
344 }
345 else
346 sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name);
347 break;
348
349 case range_misc:
350 sprintf (obuf, "Range: %s", pl->contr->ranges[range_misc] ? query_base_name (pl->contr->ranges[range_misc], 0) : "none");
351 break;
352
353 /* range_scroll is only used for controlling golems. If the
354 * the player does not have a golem, reset some things.
355 */
356 case range_golem:
357 if (object *golem = pl->contr->ranges[range_golem])
358 sprintf (obuf, "Range: golem (%s)", &golem->name);
359 else
360 {
361 pl->contr->shoottype = range_none;
362 strcpy (obuf, "Range: nothing");
363 }
364 break;
365
366 case range_skill:
367 sprintf (obuf, "Skill: %s", pl->chosen_skill != NULL ? (const char *) pl->chosen_skill->name : "none");
368 break;
369
370 case range_builder:
371 sprintf (obuf, "Builder: %s", query_base_name (pl->contr->ranges[range_builder], 0));
372 break;
373
374 default:
375 strcpy (obuf, "Range: illegal");
376 }
377} 301}
378 302
379/** 303/**
380 * Sets player title. 304 * Sets player title.
381 */ 305 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines