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

Comparing deliantra/server/socket/item.C (file contents):
Revision 1.70 by root, Sun Aug 31 02:01:41 2008 UTC vs.
Revision 1.76 by root, Sun Dec 28 06:59:27 2008 UTC

399 if (flags & UPD_FLAGS) 399 if (flags & UPD_FLAGS)
400 sl << uint32 (query_flags (op)); 400 sl << uint32 (query_flags (op));
401 401
402 if (flags & UPD_WEIGHT) 402 if (flags & UPD_WEIGHT)
403 { 403 {
404 sint32 weight = op->flag [FLAG_NO_PICK] ? -1 : op->client_weight (); 404 sint32 weight = op->client_weight ();
405 405
406 if (op) 406 if (op == pl)
407 ns->last_weight = weight; 407 ns->last_weight = weight;
408 408
409 sl << uint32 (weight); 409 sl << uint32 (weight);
410 } 410 }
411 411
597 597
598 if (object *op = esrv_get_ob_from_count (pl->ob, tag)) 598 if (object *op = esrv_get_ob_from_count (pl->ob, tag))
599 { 599 {
600 std::string s = op->describe (pl->ob); 600 std::string s = op->describe (pl->ob);
601 601
602 if (msg_is_special (s.c_str (), false))
603 cfperl_expand_cfpod (pl, s);
604
605 packet sl ("ex"); 602 packet sl ("ex");
606 sl << ber32 (tag) << s.c_str (); 603 sl << ber32 (tag)
604 << data (*pl->expand_cfpod (s.c_str ()));
607 605
608 pl->ns->send_packet (sl); 606 pl->ns->send_packet (sl);
609 } 607 }
610} 608}
611 609
686 object *ob = pl->ob; 684 object *ob = pl->ob;
687 685
688 if (!pl->observe->map) 686 if (!pl->observe->map)
689 return; 687 return;
690 688
689 bool wiz = ob->flag [FLAG_WIZ] || ob->flag [FLAG_WIZLOOK];
690
691 mapxy pos (pl->observe); 691 mapxy pos (pl->observe);
692 pos.move (dx, dy); 692 pos.move (dx, dy);
693 693
694 if (wiz)
695 {
694 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 ())
695 for (object *tmp = pos->top; tmp; tmp = tmp->below) 721 for (object *tmp = pos->top; tmp; tmp = tmp->below)
696 { 722 {
697 if (tmp->invisible && !QUERY_FLAG (ob, FLAG_WIZ)) 723 if (tmp->invisible && !QUERY_FLAG (ob, FLAG_WIZ))
698 continue; 724 continue;
699 725
700 if (QUERY_FLAG (ob, FLAG_WIZ)) 726 if (wiz)
701 buf.printf ("- %s (%d).\n", query_name (tmp), tmp->count); 727 buf.printf (" - %s (%d).\n", query_name (tmp), tmp->count);
702 else 728 else
703 buf.printf ("- %s.\n", query_name (tmp)); 729 buf.printf (" - %s.\n", query_name (tmp));
704 730
705 object *head = tmp->head_ (); 731 object *head = tmp->head_ ();
706 732
707 if (head->inv) 733 if (head->inv)
708 if ((head->type != CONTAINER && head->type != FLESH) 734 if ((head->type != CONTAINER && head->type != FLESH)
709 || QUERY_FLAG (ob, FLAG_WIZ)) 735 || QUERY_FLAG (ob, FLAG_WIZ))
710 buf << head->query_inventory (ob, " "); 736 buf << head->query_inventory (ob, " ");
711 737
712 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 */
713 break; 739 break;
740 }
714 } 741 }
715 742
716 if (buf.empty ()) 743 if (buf.empty ())
717 pl->failmsg ("You see nothing there."); 744 buf << "You see nothing there.";
718 else 745
719 pl->infobox (MSG_CHANNEL ("lookat"), buf); 746 pl->infobox (MSG_CHANNEL ("lookat"), buf);
720} 747}
721 748
722/** Client wants to look at some object. Lets do so. */ 749/** Client wants to look at some object. Lets do so. */
723void 750void
724LookAt (char *buf, int len, player *pl) 751LookAt (char *buf, int len, player *pl)
728 int dx = atoi (buf); 755 int dx = atoi (buf);
729 if (!(cp = strchr (buf, ' '))) 756 if (!(cp = strchr (buf, ' ')))
730 return; 757 return;
731 758
732 int dy = atoi (cp); 759 int dy = atoi (cp);
733
734 if (player *opl = pl->observe->contr)
735 if (client *ns = opl->ns)
736 {
737 if (fabs (dx) > ns->mapx / 2 || fabs (dy) > ns->mapy / 2)
738 return;
739
740 if (opl->blocked_los[dx + ns->mapx / 2][dy + ns->mapy / 2])
741 return;
742 }
743 760
744 look_at (pl, dx, dy); 761 look_at (pl, dx, dy);
745} 762}
746 763
747/** Move an object to a new location */ 764/** Move an object to a new location */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines