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.8 by root, Sat Sep 16 22:24:13 2006 UTC vs.
Revision 1.10 by root, Wed Sep 27 00:36:09 2006 UTC

605 605
606/** Client wants to examine some object. So lets do so. */ 606/** Client wants to examine some object. So lets do so. */
607void 607void
608ExamineCmd (char *buf, int len, player *pl) 608ExamineCmd (char *buf, int len, player *pl)
609{ 609{
610 long tag = atoi (buf); 610 tag_t tag = atoi (buf);
611
612 /* If the high bit is set, player examined a pseudo object. */
613 if (tag & 0x80000000)
614 return;
615
611 object *op = esrv_get_ob_from_count (pl->ob, tag); 616 object *op = esrv_get_ob_from_count (pl->ob, tag);
612 617
613 if (!op) 618 if (!op)
614 { 619 {
615 LOG (llevDebug, "Player '%s' tried to examine the unknown object (%ld)\n", &pl->ob->name, tag); 620 LOG (llevDebug, "Player '%s' tried to examine the unknown object (%ld)\n", &pl->ob->name, tag);
616 return; 621 return;
617 } 622 }
623
618 examine (pl->ob, op); 624 examine (pl->ob, op);
619} 625}
620 626
621/** Client wants to apply some object. Lets do so. */ 627/** Client wants to apply some object. Lets do so. */
622void 628void
623ApplyCmd (char *buf, int len, player *pl) 629ApplyCmd (char *buf, int len, player *pl)
624{ 630{
625 uint32 tag = atoi (buf); 631 tag_t tag = atoi (buf);
626 object *op = esrv_get_ob_from_count (pl->ob, tag);
627 632
628 /* sort of a hack, but if the player saves and the player then manually 633 /* sort of a hack, but if the player saves and the player then manually
629 * applies a savebed (or otherwise tries to do stuff), we run into trouble. 634 * applies a savebed (or otherwise tries to do stuff), we run into trouble.
630 */ 635 */
631 if (QUERY_FLAG (pl->ob, FLAG_REMOVED)) 636 if (QUERY_FLAG (pl->ob, FLAG_REMOVED))
637 pl->socket.look_position = tag & 0x7fffffff; 642 pl->socket.look_position = tag & 0x7fffffff;
638 pl->socket.update_look = 1; 643 pl->socket.update_look = 1;
639 return; 644 return;
640 } 645 }
641 646
647 object *op = esrv_get_ob_from_count (pl->ob, tag);
648
642 if (!op) 649 if (!op)
643 { 650 {
644 LOG (llevDebug, "Player '%s' tried to apply the unknown object (%d)\n", &pl->ob->name, tag); 651 LOG (llevDebug, "Player '%s' tried to apply the unknown object (%d)\n", &pl->ob->name, tag);
645 return; 652 return;
646 } 653 }
654
647 player_apply (pl->ob, op, 0, 0); 655 player_apply (pl->ob, op, 0, 0);
648} 656}
649 657
650/** Client wants to apply some object. Lets do so. */ 658/** Client wants to apply some object. Lets do so. */
651void 659void
677 int tag; 685 int tag;
678 object *op; 686 object *op;
679 687
680 tag = GetInt_String (data); 688 tag = GetInt_String (data);
681 op = esrv_get_ob_from_count (pl->ob, tag); 689 op = esrv_get_ob_from_count (pl->ob, tag);
690
682 if (!op) 691 if (!op)
683 { 692 {
684 new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to mark"); 693 new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to mark");
685 return; 694 return;
686 } 695 }
696
687 pl->mark = op; 697 pl->mark = op;
688 pl->mark_count = op->count;
689 new_draw_info_format (NDI_UNIQUE, 0, pl->ob, "Marked item %s", query_name (op)); 698 new_draw_info_format (NDI_UNIQUE, 0, pl->ob, "Marked item %s", query_name (op));
690} 699}
691 700
692 701
693/** 702/**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines