ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/los.C
(Generate patch)

Comparing deliantra/server/common/los.C (file contents):
Revision 1.10 by root, Thu Dec 21 23:37:05 2006 UTC vs.
Revision 1.11 by root, Sat Dec 23 13:56:25 2006 UTC

519 * change_map_light function 519 * change_map_light function
520 */ 520 */
521void 521void
522update_all_map_los (maptile *map) 522update_all_map_los (maptile *map)
523{ 523{
524 player *pl; 524 for_all_players (pl)
525
526 for (pl = first_player; pl != NULL; pl = pl->next)
527 {
528 if (pl->ob->map == map) 525 if (pl->ob->map == map)
529 pl->do_los = 1; 526 pl->do_los = 1;
530 }
531} 527}
532 528
533 529
534/* 530/*
535 * This function makes sure that update_los() will be called for all 531 * This function makes sure that update_los() will be called for all
545 */ 541 */
546 542
547void 543void
548update_all_los (const maptile *map, int x, int y) 544update_all_los (const maptile *map, int x, int y)
549{ 545{
550 player *pl; 546 for_all_players (pl)
551
552 for (pl = first_player; pl; pl = pl->next)
553 { 547 {
554 /* Player should not have a null map, but do this 548 /* Player should not have a null map, but do this
555 * check as a safety 549 * check as a safety
556 */ 550 */
557 if (!pl->ob->map) 551 if (!pl->ob->map)
612 606
613/* 607/*
614 * Debug-routine which dumps the array which specifies the visible 608 * Debug-routine which dumps the array which specifies the visible
615 * area of a player. Triggered by the z key in DM mode. 609 * area of a player. Triggered by the z key in DM mode.
616 */ 610 */
617
618void 611void
619print_los (object *op) 612print_los (object *op)
620{ 613{
621 int x, y; 614 int x, y;
622 char buf[50], buf2[10]; 615 char buf[50], buf2[10];
623 616
624 strcpy (buf, " "); 617 strcpy (buf, " ");
618
625 for (x = 0; x < op->contr->ns->mapx; x++) 619 for (x = 0; x < op->contr->ns->mapx; x++)
626 { 620 {
627 sprintf (buf2, "%2d", x); 621 sprintf (buf2, "%2d", x);
628 strcat (buf, buf2); 622 strcat (buf, buf2);
629 } 623 }
624
630 new_draw_info (NDI_UNIQUE, 0, op, buf); 625 new_draw_info (NDI_UNIQUE, 0, op, buf);
626
631 for (y = 0; y < op->contr->ns->mapy; y++) 627 for (y = 0; y < op->contr->ns->mapy; y++)
632 { 628 {
633 sprintf (buf, "%2d:", y); 629 sprintf (buf, "%2d:", y);
630
634 for (x = 0; x < op->contr->ns->mapx; x++) 631 for (x = 0; x < op->contr->ns->mapx; x++)
635 { 632 {
636 sprintf (buf2, " %1d", op->contr->blocked_los[x][y]); 633 sprintf (buf2, " %1d", op->contr->blocked_los[x][y]);
637 strcat (buf, buf2); 634 strcat (buf, buf2);
638 } 635 }
636
639 new_draw_info (NDI_UNIQUE, 0, op, buf); 637 new_draw_info (NDI_UNIQUE, 0, op, buf);
640 } 638 }
641} 639}
642 640
643/* 641/*
646 */ 644 */
647 645
648void 646void
649make_sure_seen (const object *op) 647make_sure_seen (const object *op)
650{ 648{
651 player *pl; 649 for_all_players (pl)
652
653 for (pl = first_player; pl; pl = pl->next)
654 if (pl->ob->map == op->map && 650 if (pl->ob->map == op->map &&
655 pl->ob->y - pl->ns->mapy / 2 <= op->y && 651 pl->ob->y - pl->ns->mapy / 2 <= op->y &&
656 pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x) 652 pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x)
657 pl->blocked_los[pl->ns->mapx / 2 + op->x - pl->ob->x][pl->ns->mapy / 2 + op->y - pl->ob->y] = 0; 653 pl->blocked_los[pl->ns->mapx / 2 + op->x - pl->ob->x][pl->ns->mapy / 2 + op->y - pl->ob->y] = 0;
658} 654}
664 */ 660 */
665 661
666void 662void
667make_sure_not_seen (const object *op) 663make_sure_not_seen (const object *op)
668{ 664{
669 player *pl; 665 for_all_players (pl)
670
671 for (pl = first_player; pl; pl = pl->next)
672 if (pl->ob->map == op->map && 666 if (pl->ob->map == op->map &&
673 pl->ob->y - pl->ns->mapy / 2 <= op->y && 667 pl->ob->y - pl->ns->mapy / 2 <= op->y &&
674 pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x) 668 pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x)
675 pl->do_los = 1; 669 pl->do_los = 1;
676} 670}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines