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

Comparing deliantra/server/server/player.C (file contents):
Revision 1.99 by root, Thu Jan 18 19:42:10 2007 UTC vs.
Revision 1.102 by root, Wed Feb 7 02:04:47 2007 UTC

527 x = mon->x; 527 x = mon->x;
528 y = mon->y; 528 y = mon->y;
529 m = mon->map; 529 m = mon->map;
530 dir = rv.direction; 530 dir = rv.direction;
531 lastdir = firstdir = rv.direction; /* perhaps we stand next to pl, init firstdir too */ 531 lastdir = firstdir = rv.direction; /* perhaps we stand next to pl, init firstdir too */
532 diff = FABS (rv.distance_x) > FABS (rv.distance_y) ? FABS (rv.distance_x) : FABS (rv.distance_y); 532 diff = ::max (abs (rv.distance_x), abs (rv.distance_y));
533
533 /* If we can't solve it within the search distance, return now. */ 534 /* If we can't solve it within the search distance, return now. */
534 if (diff > max) 535 if (diff > max)
535 return 0; 536 return 0;
537
536 while (diff > 1 && max > 0) 538 while (diff > 1 && max > 0)
537 { 539 {
538 lastx = x; 540 lastx = x;
539 lasty = y; 541 lasty = y;
540 lastmap = m; 542 lastmap = m;
622 max--; 624 max--;
623 lastdir = dir; 625 lastdir = dir;
624 if (!firstdir) 626 if (!firstdir)
625 firstdir = dir; 627 firstdir = dir;
626 } 628 }
629
627 if (diff <= 1) 630 if (diff <= 1)
628 { 631 {
629 /* Recalculate diff (distance) because we may not have actually 632 /* Recalculate diff (distance) because we may not have actually
630 * headed toward player for entire distance. 633 * headed toward player for entire distance.
631 */ 634 */
632 get_rangevector_from_mapcoord (m, x, y, pl, &rv, 0); 635 get_rangevector_from_mapcoord (m, x, y, pl, &rv, 0);
633 diff = FABS (rv.distance_x) > FABS (rv.distance_y) ? FABS (rv.distance_x) : FABS (rv.distance_y); 636 diff = ::max (abs (rv.distance_x), abs (rv.distance_y));
634 } 637 }
638
635 if (diff > max) 639 if (diff > max)
636 return 0; 640 return 0;
637 } 641 }
642
638 /* If we reached the max, didn't find a direction in time */ 643 /* If we reached the max, didn't find a direction in time */
639 if (!max) 644 if (!max)
640 return 0; 645 return 0;
641 646
642 return firstdir; 647 return firstdir;
2703 tmp->name = buf; 2708 tmp->name = buf;
2704 sprintf (buf, " This finger has been cut off %s\n" 2709 sprintf (buf, " This finger has been cut off %s\n"
2705 " the %s, when he was defeated at\n level %d by %s.\n", 2710 " the %s, when he was defeated at\n level %d by %s.\n",
2706 &op->name, op->contr->title, (int) (op->level), op->contr->killer); 2711 &op->name, op->contr->title, (int) (op->level), op->contr->killer);
2707 tmp->msg = buf; 2712 tmp->msg = buf;
2708 tmp->value = 0, tmp->material = 0, tmp->type = 0; 2713 tmp->value = 0, tmp->type = 0;
2709 tmp->materialname = NULL; 2714 tmp->materialname = "organics";
2710 tmp->insert_at (op, tmp); 2715 tmp->insert_at (op, tmp);
2711 } 2716 }
2712 2717
2713 /* teleport defeated player to new destination */ 2718 /* teleport defeated player to new destination */
2714 transfer_ob (op, x, y, 0, NULL); 2719 transfer_ob (op, x, y, 0, NULL);
3534 pl->ranges[i] = 0; 3539 pl->ranges[i] = 0;
3535 if (pl->shoottype == i) 3540 if (pl->shoottype == i)
3536 pl->shoottype = range_none; 3541 pl->shoottype = range_none;
3537 } 3542 }
3538} 3543}
3544
3545sint8
3546player::visibility_at (maptile *map, int x, int y) const
3547{
3548 if (!ns)
3549 return 0;
3550
3551 int dx, dy;
3552 if (!adjacent_map (map, ns->current_map, &dx, &dy))
3553 return 0;
3554
3555 x += dx - ns->current_x + ns->mapx / 2;
3556 y += dy - ns->current_y + ns->mapy / 2;
3557
3558 if (!IN_RANGE_EXC (x, 0, ns->mapx) || !IN_RANGE_EXC (y, 0, ns->mapy))
3559 return 0;
3560
3561 return 100 - blocked_los [x][y];
3562}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines