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.11 by root, Wed Dec 13 21:27:09 2006 UTC

395 /* we remove the check for op->env, because in theory, the object 395 /* we remove the check for op->env, because in theory, the object
396 * is hopefully in the same place, so the client should preserve 396 * is hopefully in the same place, so the client should preserve
397 * order. 397 * order.
398 */ 398 */
399 } 399 }
400
400 if (!QUERY_FLAG (op, FLAG_CLIENT_SENT)) 401 if (!QUERY_FLAG (op, FLAG_CLIENT_SENT))
401 { 402 {
402 /* FLAG_CLIENT_SENT is debug only. We are using it to see where 403 /* FLAG_CLIENT_SENT is debug only. We are using it to see where
403 * this is happening - we can set a breakpoint here in the debugger 404 * this is happening - we can set a breakpoint here in the debugger
404 * and track back the call. 405 * and track back the call.
405 */ 406 */
406 LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count); 407 LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count);
407 } 408 }
409
408 sl.buf = (unsigned char *) malloc (MAXSOCKBUF); 410 sl.buf = (unsigned char *) malloc (MAXSOCKBUF);
409 411
410 strcpy ((char *) sl.buf, "upditem "); 412 strcpy ((char *) sl.buf, "upditem ");
411 sl.len = strlen ((char *) sl.buf); 413 sl.len = strlen ((char *) sl.buf);
412 414
438 { 440 {
439 if (!(pl->contr->socket.faces_sent[op->face->number] & NS_FACESENT_FACE)) 441 if (!(pl->contr->socket.faces_sent[op->face->number] & NS_FACESENT_FACE))
440 esrv_send_face (&pl->contr->socket, op->face->number, 0); 442 esrv_send_face (&pl->contr->socket, op->face->number, 0);
441 SockList_AddInt (&sl, op->face->number); 443 SockList_AddInt (&sl, op->face->number);
442 } 444 }
445
443 if (flags & UPD_NAME) 446 if (flags & UPD_NAME)
444 { 447 {
445 int len; 448 int len;
446 const char *item_p; 449 const char *item_p;
447 char item_n[MAX_BUF]; 450 char item_n[MAX_BUF];
466 len += strlen (item_n + 1 + len) + 1; 469 len += strlen (item_n + 1 + len) + 1;
467 SockList_AddChar (&sl, (char) len); 470 SockList_AddChar (&sl, (char) len);
468 memcpy (sl.buf + sl.len, item_n, len); 471 memcpy (sl.buf + sl.len, item_n, len);
469 sl.len += len; 472 sl.len += len;
470 } 473 }
474
471 if (flags & UPD_ANIM) 475 if (flags & UPD_ANIM)
472 SockList_AddShort (&sl, op->animation_id); 476 SockList_AddShort (&sl, op->animation_id);
473 477
474 if (flags & UPD_ANIMSPEED) 478 if (flags & UPD_ANIMSPEED)
475 { 479 {
605 609
606/** Client wants to examine some object. So lets do so. */ 610/** Client wants to examine some object. So lets do so. */
607void 611void
608ExamineCmd (char *buf, int len, player *pl) 612ExamineCmd (char *buf, int len, player *pl)
609{ 613{
610 long tag = atoi (buf); 614 tag_t tag = atoi (buf);
615
616 /* If the high bit is set, player examined a pseudo object. */
617 if (tag & 0x80000000)
618 return;
619
611 object *op = esrv_get_ob_from_count (pl->ob, tag); 620 object *op = esrv_get_ob_from_count (pl->ob, tag);
612 621
613 if (!op) 622 if (!op)
614 { 623 {
615 LOG (llevDebug, "Player '%s' tried to examine the unknown object (%ld)\n", &pl->ob->name, tag); 624 LOG (llevDebug, "Player '%s' tried to examine the unknown object (%ld)\n", &pl->ob->name, tag);
616 return; 625 return;
617 } 626 }
627
618 examine (pl->ob, op); 628 examine (pl->ob, op);
619} 629}
620 630
621/** Client wants to apply some object. Lets do so. */ 631/** Client wants to apply some object. Lets do so. */
622void 632void
623ApplyCmd (char *buf, int len, player *pl) 633ApplyCmd (char *buf, int len, player *pl)
624{ 634{
625 uint32 tag = atoi (buf); 635 tag_t tag = atoi (buf);
626 object *op = esrv_get_ob_from_count (pl->ob, tag);
627 636
628 /* sort of a hack, but if the player saves and the player then manually 637 /* 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. 638 * applies a savebed (or otherwise tries to do stuff), we run into trouble.
630 */ 639 */
631 if (QUERY_FLAG (pl->ob, FLAG_REMOVED)) 640 if (QUERY_FLAG (pl->ob, FLAG_REMOVED))
637 pl->socket.look_position = tag & 0x7fffffff; 646 pl->socket.look_position = tag & 0x7fffffff;
638 pl->socket.update_look = 1; 647 pl->socket.update_look = 1;
639 return; 648 return;
640 } 649 }
641 650
651 object *op = esrv_get_ob_from_count (pl->ob, tag);
652
642 if (!op) 653 if (!op)
643 { 654 {
644 LOG (llevDebug, "Player '%s' tried to apply the unknown object (%d)\n", &pl->ob->name, tag); 655 LOG (llevDebug, "Player '%s' tried to apply the unknown object (%d)\n", &pl->ob->name, tag);
645 return; 656 return;
646 } 657 }
658
647 player_apply (pl->ob, op, 0, 0); 659 player_apply (pl->ob, op, 0, 0);
648} 660}
649 661
650/** Client wants to apply some object. Lets do so. */ 662/** Client wants to apply some object. Lets do so. */
651void 663void
677 int tag; 689 int tag;
678 object *op; 690 object *op;
679 691
680 tag = GetInt_String (data); 692 tag = GetInt_String (data);
681 op = esrv_get_ob_from_count (pl->ob, tag); 693 op = esrv_get_ob_from_count (pl->ob, tag);
694
682 if (!op) 695 if (!op)
683 { 696 {
684 new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to mark"); 697 new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to mark");
685 return; 698 return;
686 } 699 }
700
687 pl->mark = op; 701 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)); 702 new_draw_info_format (NDI_UNIQUE, 0, pl->ob, "Marked item %s", query_name (op));
690} 703}
691 704
692 705
693/** 706/**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines