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.6 by root, Tue Sep 12 19:20:09 2006 UTC vs.
Revision 1.10 by root, Wed Sep 27 00:36:09 2006 UTC

16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 20
21 The author can be reached via e-mail to crossfire-devel@real-time.com 21 The author can be reached via e-mail to <crossfire@schmorp.de>
22*/ 22*/
23 23
24/** 24/**
25 * \file 25 * \file
26 * Client/server logic. 26 * Client/server logic.
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/**
700look_at (object *op, int dx, int dy) 709look_at (object *op, int dx, int dy)
701{ 710{
702 object *tmp; 711 object *tmp;
703 int flag = 0; 712 int flag = 0;
704 sint16 x, y; 713 sint16 x, y;
705 mapstruct *m; 714 maptile *m;
706 715
707 x = op->x + dx; 716 x = op->x + dx;
708 y = op->y + dy; 717 y = op->y + dy;
709 718
710 if (out_of_map (op->map, x, y)) 719 if (out_of_map (op->map, x, y))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines