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.5 by root, Sun Sep 10 13:43:33 2006 UTC vs.
Revision 1.10 by root, Wed Sep 27 00:36:09 2006 UTC

1
2/*
3 * static char *rcsid_item_c =
4 * "$Id: item.C,v 1.5 2006/09/10 13:43:33 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
22 16
23 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
24 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 20
27 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>
28*/ 22*/
29 23
30/** 24/**
31 * \file 25 * \file
32 * Client/server logic. 26 * Client/server logic.
611 605
612/** Client wants to examine some object. So lets do so. */ 606/** Client wants to examine some object. So lets do so. */
613void 607void
614ExamineCmd (char *buf, int len, player *pl) 608ExamineCmd (char *buf, int len, player *pl)
615{ 609{
616 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
617 object *op = esrv_get_ob_from_count (pl->ob, tag); 616 object *op = esrv_get_ob_from_count (pl->ob, tag);
618 617
619 if (!op) 618 if (!op)
620 { 619 {
621 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);
622 return; 621 return;
623 } 622 }
623
624 examine (pl->ob, op); 624 examine (pl->ob, op);
625} 625}
626 626
627/** Client wants to apply some object. Lets do so. */ 627/** Client wants to apply some object. Lets do so. */
628void 628void
629ApplyCmd (char *buf, int len, player *pl) 629ApplyCmd (char *buf, int len, player *pl)
630{ 630{
631 uint32 tag = atoi (buf); 631 tag_t tag = atoi (buf);
632 object *op = esrv_get_ob_from_count (pl->ob, tag);
633 632
634 /* 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
635 * 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.
636 */ 635 */
637 if (QUERY_FLAG (pl->ob, FLAG_REMOVED)) 636 if (QUERY_FLAG (pl->ob, FLAG_REMOVED))
643 pl->socket.look_position = tag & 0x7fffffff; 642 pl->socket.look_position = tag & 0x7fffffff;
644 pl->socket.update_look = 1; 643 pl->socket.update_look = 1;
645 return; 644 return;
646 } 645 }
647 646
647 object *op = esrv_get_ob_from_count (pl->ob, tag);
648
648 if (!op) 649 if (!op)
649 { 650 {
650 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);
651 return; 652 return;
652 } 653 }
654
653 player_apply (pl->ob, op, 0, 0); 655 player_apply (pl->ob, op, 0, 0);
654} 656}
655 657
656/** Client wants to apply some object. Lets do so. */ 658/** Client wants to apply some object. Lets do so. */
657void 659void
683 int tag; 685 int tag;
684 object *op; 686 object *op;
685 687
686 tag = GetInt_String (data); 688 tag = GetInt_String (data);
687 op = esrv_get_ob_from_count (pl->ob, tag); 689 op = esrv_get_ob_from_count (pl->ob, tag);
690
688 if (!op) 691 if (!op)
689 { 692 {
690 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");
691 return; 694 return;
692 } 695 }
696
693 pl->mark = op; 697 pl->mark = op;
694 pl->mark_count = op->count;
695 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));
696} 699}
697 700
698 701
699/** 702/**
706look_at (object *op, int dx, int dy) 709look_at (object *op, int dx, int dy)
707{ 710{
708 object *tmp; 711 object *tmp;
709 int flag = 0; 712 int flag = 0;
710 sint16 x, y; 713 sint16 x, y;
711 mapstruct *m; 714 maptile *m;
712 715
713 x = op->x + dx; 716 x = op->x + dx;
714 y = op->y + dy; 717 y = op->y + dy;
715 718
716 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