… | |
… | |
684 | object *ob = pl->ob; |
684 | object *ob = pl->ob; |
685 | |
685 | |
686 | if (!pl->observe->map) |
686 | if (!pl->observe->map) |
687 | return; |
687 | return; |
688 | |
688 | |
|
|
689 | bool wiz = ob->flag [FLAG_WIZ] || ob->flag [FLAG_WIZLOOK]; |
|
|
690 | |
689 | mapxy pos (pl->observe); |
691 | mapxy pos (pl->observe); |
690 | pos.move (dx, dy); |
692 | pos.move (dx, dy); |
691 | |
693 | |
|
|
694 | if (wiz) |
|
|
695 | { |
692 | if (pos.normalise ()) |
696 | if (pos.normalise ()) |
|
|
697 | { |
|
|
698 | mapspace &ms = *pos; |
|
|
699 | ms.update (); |
|
|
700 | |
|
|
701 | buf.printf (" map: %s%+d%+d (%+d%+d)\n" |
|
|
702 | " smell %u/%u; flags %x; light %d; block %x; slow %x; on %x; off %x; volume %lld\n\n", |
|
|
703 | &pos.m->path, pos.x, pos.y, dx, dy, |
|
|
704 | (unsigned int)ms.smell, (unsigned int)mapspace::smellcount, ms.flags (), ms.light, |
|
|
705 | ms.move_block, ms.move_slow, ms.move_on, ms.move_off, (long long)ms.volume () |
|
|
706 | ); |
|
|
707 | } |
|
|
708 | else |
|
|
709 | buf << "off-map\n\n"; |
|
|
710 | } |
|
|
711 | |
|
|
712 | int darkness = pl->blocked_los (dx, dy); |
|
|
713 | |
|
|
714 | if (darkness == LOS_BLOCKED) |
|
|
715 | buf << "You cannot see that place from your position. H<Something is in between or it is too far away.>"; |
|
|
716 | else if (darkness == LOS_MAX) |
|
|
717 | buf << "That place is too dark to see anything. H<Move nearer or find better lighting.>"; |
|
|
718 | else |
|
|
719 | { |
|
|
720 | if (pos.normalise ()) |
693 | for (object *tmp = pos->top; tmp; tmp = tmp->below) |
721 | for (object *tmp = pos->top; tmp; tmp = tmp->below) |
694 | { |
722 | { |
695 | if (tmp->invisible && !QUERY_FLAG (ob, FLAG_WIZ)) |
723 | if (tmp->invisible && !QUERY_FLAG (ob, FLAG_WIZ)) |
696 | continue; |
724 | continue; |
697 | |
725 | |
698 | if (QUERY_FLAG (ob, FLAG_WIZ)) |
726 | if (wiz) |
699 | buf.printf (" - %s (%d).\n", query_name (tmp), tmp->count); |
727 | buf.printf (" - %s (%d).\n", query_name (tmp), tmp->count); |
700 | else |
728 | else |
701 | buf.printf (" - %s.\n", query_name (tmp)); |
729 | buf.printf (" - %s.\n", query_name (tmp)); |
702 | |
730 | |
703 | object *head = tmp->head_ (); |
731 | object *head = tmp->head_ (); |
704 | |
732 | |
705 | if (head->inv) |
733 | if (head->inv) |
706 | if ((head->type != CONTAINER && head->type != FLESH) |
734 | if ((head->type != CONTAINER && head->type != FLESH) |
707 | || QUERY_FLAG (ob, FLAG_WIZ)) |
735 | || QUERY_FLAG (ob, FLAG_WIZ)) |
708 | buf << head->query_inventory (ob, " "); |
736 | buf << head->query_inventory (ob, " "); |
709 | |
737 | |
710 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR) && !QUERY_FLAG (ob, FLAG_WIZ)) /* don't continue under the floor */ |
738 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR) && !wiz) /* don't continue under the floor */ |
711 | break; |
739 | break; |
|
|
740 | } |
712 | } |
741 | } |
713 | |
742 | |
714 | if (buf.empty ()) |
743 | if (buf.empty ()) |
715 | pl->failmsg ("You see nothing there."); |
744 | buf << "You see nothing there."; |
716 | else |
745 | |
717 | pl->infobox (MSG_CHANNEL ("lookat"), buf); |
746 | pl->infobox (MSG_CHANNEL ("lookat"), buf); |
718 | } |
747 | } |
719 | |
748 | |
720 | /** Client wants to look at some object. Lets do so. */ |
749 | /** Client wants to look at some object. Lets do so. */ |
721 | void |
750 | void |
722 | LookAt (char *buf, int len, player *pl) |
751 | LookAt (char *buf, int len, player *pl) |
… | |
… | |
726 | int dx = atoi (buf); |
755 | int dx = atoi (buf); |
727 | if (!(cp = strchr (buf, ' '))) |
756 | if (!(cp = strchr (buf, ' '))) |
728 | return; |
757 | return; |
729 | |
758 | |
730 | int dy = atoi (cp); |
759 | int dy = atoi (cp); |
731 | |
|
|
732 | if (player *opl = pl->observe->contr) |
|
|
733 | if (client *ns = opl->ns) |
|
|
734 | if (opl->blocked_los (dx, dy) >= LOS_MAX) |
|
|
735 | return; |
|
|
736 | |
760 | |
737 | look_at (pl, dx, dy); |
761 | look_at (pl, dx, dy); |
738 | } |
762 | } |
739 | |
763 | |
740 | /** Move an object to a new location */ |
764 | /** Move an object to a new location */ |