1 | |
|
|
2 | /* |
|
|
3 | * static char *rcsid_sock_info_c = |
|
|
4 | * "$Id: info.C,v 1.5 2006/09/10 13:43:33 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
1 | |
7 | /* |
2 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
3 | CrossFire, A Multiplayer game for X-windows |
9 | |
4 | |
10 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
… | |
… | |
22 | |
17 | |
23 | You should have received a copy of the GNU General Public License |
18 | You should have received a copy of the GNU General Public License |
24 | along with this program; if not, write to the Free Software |
19 | along with this program; if not, write to the Free Software |
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | |
21 | |
27 | The authors can be reached via e-mail at crossfire-devel@real-time.com |
22 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
28 | */ |
23 | */ |
29 | |
24 | |
30 | /** |
25 | /** |
31 | * \file |
26 | * \file |
32 | * Basic client output functions. |
27 | * Basic client output functions. |
… | |
… | |
355 | /** |
350 | /** |
356 | * Writes to everyone on the map *except* op. This is useful for emotions. |
351 | * Writes to everyone on the map *except* op. This is useful for emotions. |
357 | */ |
352 | */ |
358 | |
353 | |
359 | void |
354 | void |
360 | new_info_map_except (int color, mapstruct *map, object *op, const char *str) |
355 | new_info_map_except (int color, maptile * map, object *op, const char *str) |
361 | { |
356 | { |
362 | player *pl; |
357 | player *pl; |
363 | |
358 | |
364 | for (pl = first_player; pl != NULL; pl = pl->next) |
359 | for (pl = first_player; pl != NULL; pl = pl->next) |
365 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op) |
360 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op) |
… | |
… | |
371 | /** |
366 | /** |
372 | * Writes to everyone on the map except op1 and op2 |
367 | * Writes to everyone on the map except op1 and op2 |
373 | */ |
368 | */ |
374 | |
369 | |
375 | void |
370 | void |
376 | new_info_map_except2 (int color, mapstruct *map, object *op1, object *op2, const char *str) |
371 | new_info_map_except2 (int color, maptile * map, object *op1, object *op2, const char *str) |
377 | { |
372 | { |
378 | player *pl; |
373 | player *pl; |
379 | |
374 | |
380 | for (pl = first_player; pl != NULL; pl = pl->next) |
375 | for (pl = first_player; pl != NULL; pl = pl->next) |
381 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op1 && pl->ob != op2) |
376 | if (pl->ob != NULL && pl->ob->map == map && pl->ob != op1 && pl->ob != op2) |
… | |
… | |
387 | /** |
382 | /** |
388 | * Writes to everyone on the specified map |
383 | * Writes to everyone on the specified map |
389 | */ |
384 | */ |
390 | |
385 | |
391 | void |
386 | void |
392 | new_info_map (int color, mapstruct *map, const char *str) |
387 | new_info_map (int color, maptile * map, const char *str) |
393 | { |
388 | { |
394 | player *pl; |
389 | player *pl; |
395 | |
390 | |
396 | for (pl = first_player; pl != NULL; pl = pl->next) |
391 | for (pl = first_player; pl != NULL; pl = pl->next) |
397 | if (pl->ob != NULL && pl->ob->map == map) |
392 | if (pl->ob != NULL && pl->ob->map == map) |
… | |
… | |
417 | void |
412 | void |
418 | rangetostring (object *pl, char *obuf) |
413 | rangetostring (object *pl, char *obuf) |
419 | { |
414 | { |
420 | switch (pl->contr->shoottype) |
415 | switch (pl->contr->shoottype) |
421 | { |
416 | { |
422 | case range_none: |
417 | case range_none: |
423 | strcpy (obuf, "Range: nothing"); |
418 | strcpy (obuf, "Range: nothing"); |
424 | break; |
419 | break; |
425 | |
420 | |
426 | case range_bow: |
421 | case range_bow: |
|
|
422 | { |
|
|
423 | object *op; |
|
|
424 | |
|
|
425 | for (op = pl->inv; op; op = op->below) |
|
|
426 | if (op->type == BOW && QUERY_FLAG (op, FLAG_APPLIED)) |
|
|
427 | break; |
|
|
428 | if (op == NULL) |
|
|
429 | break; |
|
|
430 | |
|
|
431 | sprintf (obuf, "Range: %s (%s)", query_base_name (op, 0), op->race ? (const char *) op->race : "nothing"); |
|
|
432 | } |
|
|
433 | break; |
|
|
434 | |
|
|
435 | case range_magic: |
|
|
436 | if (settings.casting_time == TRUE) |
427 | { |
437 | { |
428 | object *op; |
438 | if (pl->casting_time > -1) |
429 | |
439 | { |
430 | for (op = pl->inv; op; op = op->below) |
440 | if (pl->casting_time == 0) |
431 | if (op->type == BOW && QUERY_FLAG (op, FLAG_APPLIED)) |
441 | sprintf (obuf, "Range: Holding spell (%s)", (const char *) pl->spell->name); |
432 | break; |
442 | else |
433 | if (op == NULL) |
443 | sprintf (obuf, "Range: Casting spell (%s)", (const char *) pl->spell->name); |
434 | break; |
444 | } |
435 | |
445 | else |
436 | sprintf (obuf, "Range: %s (%s)", query_base_name (op, 0), op->race ? (const char *) op->race : "nothing"); |
446 | sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); |
437 | } |
447 | } |
438 | break; |
|
|
439 | |
|
|
440 | case range_magic: |
|
|
441 | if (settings.casting_time == TRUE) |
|
|
442 | { |
|
|
443 | if (pl->casting_time > -1) |
|
|
444 | { |
|
|
445 | if (pl->casting_time == 0) |
|
|
446 | sprintf (obuf, "Range: Holding spell (%s)", (const char *) pl->spell->name); |
|
|
447 | else |
|
|
448 | sprintf (obuf, "Range: Casting spell (%s)", (const char *) pl->spell->name); |
|
|
449 | } |
|
|
450 | else |
|
|
451 | sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); |
|
|
452 | } |
|
|
453 | else |
448 | else |
454 | sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); |
449 | sprintf (obuf, "Range: spell (%s)", &pl->contr->ranges[range_magic]->name); |
455 | break; |
450 | break; |
456 | |
451 | |
457 | case range_misc: |
452 | case range_misc: |
458 | sprintf (obuf, "Range: %s", pl->contr->ranges[range_misc] ? query_base_name (pl->contr->ranges[range_misc], 0) : "none"); |
453 | sprintf (obuf, "Range: %s", pl->contr->ranges[range_misc] ? query_base_name (pl->contr->ranges[range_misc], 0) : "none"); |
459 | break; |
454 | break; |
460 | |
455 | |
461 | /* range_scroll is only used for controlling golems. If the |
456 | /* range_scroll is only used for controlling golems. If the |
462 | * the player does not have a golem, reset some things. |
457 | * the player does not have a golem, reset some things. |
463 | */ |
458 | */ |
464 | case range_golem: |
459 | case range_golem: |
465 | if (pl->contr->ranges[range_golem] != NULL) |
460 | if (pl->contr->ranges[range_golem] != NULL) |
466 | sprintf (obuf, "Range: golem (%s)", &pl->contr->ranges[range_golem]->name); |
461 | sprintf (obuf, "Range: golem (%s)", &pl->contr->ranges[range_golem]->name); |
467 | else |
462 | else |
468 | { |
463 | { |
469 | pl->contr->shoottype = range_none; |
464 | pl->contr->shoottype = range_none; |
470 | strcpy (obuf, "Range: nothing"); |
465 | strcpy (obuf, "Range: nothing"); |
471 | } |
466 | } |
472 | break; |
467 | break; |
473 | |
468 | |
474 | case range_skill: |
469 | case range_skill: |
475 | sprintf (obuf, "Skill: %s", pl->chosen_skill != NULL ? (const char *) pl->chosen_skill->name : "none"); |
470 | sprintf (obuf, "Skill: %s", pl->chosen_skill != NULL ? (const char *) pl->chosen_skill->name : "none"); |
476 | break; |
471 | break; |
477 | |
472 | |
478 | case range_builder: |
473 | case range_builder: |
479 | sprintf (obuf, "Builder: %s", query_base_name (pl->contr->ranges[range_builder], 0)); |
474 | sprintf (obuf, "Builder: %s", query_base_name (pl->contr->ranges[range_builder], 0)); |
480 | break; |
475 | break; |
481 | |
476 | |
482 | default: |
477 | default: |
483 | strcpy (obuf, "Range: illegal"); |
478 | strcpy (obuf, "Range: illegal"); |
484 | } |
479 | } |
485 | } |
480 | } |
486 | |
481 | |
487 | /** |
482 | /** |
488 | * Sets player title. |
483 | * Sets player title. |
… | |
… | |
512 | static void |
507 | static void |
513 | magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) |
508 | magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) |
514 | { |
509 | { |
515 | int x, y, dx, dy, mflags; |
510 | int x, y, dx, dy, mflags; |
516 | sint16 nx, ny; |
511 | sint16 nx, ny; |
517 | mapstruct *mp; |
512 | maptile *mp; |
518 | New_Face *f; |
513 | New_Face *f; |
519 | |
514 | |
520 | for (dx = -1; dx <= 1; dx++) |
515 | for (dx = -1; dx <= 1; dx++) |
521 | { |
516 | { |
522 | for (dy = -1; dy <= 1; dy++) |
517 | for (dy = -1; dy <= 1; dy++) |
… | |
… | |
578 | void |
573 | void |
579 | magic_mapping_mark (object *pl, char *map_mark, int strength) |
574 | magic_mapping_mark (object *pl, char *map_mark, int strength) |
580 | { |
575 | { |
581 | int x, y, mflags; |
576 | int x, y, mflags; |
582 | sint16 nx, ny; |
577 | sint16 nx, ny; |
583 | mapstruct *mp; |
578 | maptile *mp; |
584 | New_Face *f; |
579 | New_Face *f; |
585 | |
580 | |
586 | for (x = -strength; x < strength; x++) |
581 | for (x = -strength; x < strength; x++) |
587 | { |
582 | { |
588 | for (y = -strength; y < strength; y++) |
583 | for (y = -strength; y < strength; y++) |