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.59 by root, Tue Apr 22 02:46:18 2008 UTC vs.
Revision 1.61 by root, Tue Apr 22 07:28:05 2008 UTC

271 if (QUERY_FLAG (head, FLAG_ANIMATE) && !ns.anims_sent[head->animation_id]) 271 if (QUERY_FLAG (head, FLAG_ANIMATE) && !ns.anims_sent[head->animation_id])
272 ns.send_animation (head->animation_id); 272 ns.send_animation (head->animation_id);
273 273
274 sl << uint32 (head->count) 274 sl << uint32 (head->count)
275 << uint32 (flags) 275 << uint32 (flags)
276 << uint32 (QUERY_FLAG (head, FLAG_NO_PICK) ? -1 : WEIGHT (head)) 276 << uint32 (QUERY_FLAG (head, FLAG_NO_PICK) ? -1 : head->client_weight ())
277 << uint32 (head->face); 277 << uint32 (head->face);
278 278
279 if (!head->custom_name) 279 if (!head->custom_name)
280 { 280 {
281 strncpy (item_n, query_base_name (head, 0), 127); 281 strncpy (item_n, query_base_name (head, 0), 127);
506 */ 506 */
507void 507void
508esrv_update_item (int flags, object *pl, object *op) 508esrv_update_item (int flags, object *pl, object *op)
509{ 509{
510 /* If we have a request to send the player item, skip a few checks. */ 510 /* If we have a request to send the player item, skip a few checks. */
511 if (op != pl)
512 {
513 if (!op->client_visible ()) 511 if (op != pl && !op->client_visible ())
514 return; 512 return;
515 /* we remove the check for op->env, because in theory, the object
516 * is hopefully in the same place, so the client should preserve
517 * order.
518 */
519 }
520 513
521 client *ns = pl->contr->ns; 514 client *ns = pl->contr->ns;
522 if (!ns) 515 if (!ns)
523 return; 516 return;
524 517
546 if (flags & UPD_FLAGS) 539 if (flags & UPD_FLAGS)
547 sl << uint32 (query_flags (op)); 540 sl << uint32 (query_flags (op));
548 541
549 if (flags & UPD_WEIGHT) 542 if (flags & UPD_WEIGHT)
550 { 543 {
551 sint32 weight = WEIGHT (op); 544 sint32 weight = op->flag [FLAG_NO_PICK] ? -1 : op->client_weight ();
552 545
553 sl << uint32 (QUERY_FLAG (op, FLAG_NO_PICK) ? -1 : weight);
554
555 if (pl == op) 546 if (op)
556 ns->last_weight = weight; 547 ns->last_weight = weight;
548
549 sl << uint32 (weight);
557 } 550 }
558 551
559 if (flags & UPD_FACE) 552 if (flags & UPD_FACE)
560 { 553 {
561 ns->send_face (op->face, -50); 554 ns->send_face (op->face, -50);
635 return; 628 return;
636 629
637 /* If this is not the player object, do some more checks */ 630 /* If this is not the player object, do some more checks */
638 if (op != pl) 631 if (op != pl)
639 { 632 {
640 /* We only send 'visibile' objects to the client */ 633 /* We only send 'visible' objects to the client */
641 if (!op->client_visible ()) 634 if (!op->client_visible ())
642 return; 635 return;
643 636
644 /* if the item is on the ground, mark that the look needs to 637 /* if the item is on the ground, mark that the look needs to
645 * be updated. 638 * be updated.
922 /* If it is an active container, then we should drop all objects 915 /* If it is an active container, then we should drop all objects
923 * in the container and not the container itself. 916 * in the container and not the container itself.
924 */ 917 */
925 if (op->inv && QUERY_FLAG (op, FLAG_APPLIED)) 918 if (op->inv && QUERY_FLAG (op, FLAG_APPLIED))
926 { 919 {
927 object *current, *next;
928
929 int cnt = MAX_ITEM_PER_DROP; 920 int cnt = MAX_ITEM_PER_DROP;
930 921
931 for (current = op->inv; current != NULL; current = next) 922 for (object *current = op->inv; current; )
932 { 923 {
933 next = current->below; 924 object *next = current->below;
925
934 drop_object (pl, current, 0); 926 drop_object (pl, current, 0);
935 927
936 if (--cnt <= 0) break; 928 if (--cnt <= 0) break;
929
930 current = next;
937 } 931 }
938 932
939 if (cnt <= 0) 933 if (cnt <= 0)
940 op->failmsg ("Only dropped some items, can't drop that many items at once."); 934 op->failmsg ("Only dropped some items, can't drop that many items at once.");
941
942 esrv_update_item (UPD_WEIGHT, pl, op);
943 } 935 }
944 else 936 else
945 drop_object (pl, op, nrof); 937 drop_object (pl, op, nrof);
946 938
947 update_after_inventory_change (pl); 939 update_after_inventory_change (pl);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines