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.91 by root, Thu Apr 8 04:49:02 2010 UTC vs.
Revision 1.94 by root, Sun Apr 11 23:48:57 2010 UTC

53static unsigned int 53static unsigned int
54query_flags (object *op) 54query_flags (object *op)
55{ 55{
56 unsigned int flags = 0; 56 unsigned int flags = 0;
57 57
58 if (QUERY_FLAG (op, FLAG_APPLIED)) 58 if (op->flag [FLAG_APPLIED])
59 switch (op->type) 59 switch (op->type)
60 { 60 {
61 case BOW: 61 case BOW:
62 case WAND: 62 case WAND:
63 case ROD: 63 case ROD:
89 } 89 }
90 90
91 if (op->is_open_container ()) 91 if (op->is_open_container ())
92 flags |= F_OPEN; 92 flags |= F_OPEN;
93 93
94 if (QUERY_FLAG (op, FLAG_KNOWN_CURSED)) 94 if (op->flag [FLAG_KNOWN_CURSED])
95 { 95 {
96 if (QUERY_FLAG (op, FLAG_DAMNED)) 96 if (op->flag [FLAG_DAMNED])
97 flags |= F_DAMNED; 97 flags |= F_DAMNED;
98 else if (QUERY_FLAG (op, FLAG_CURSED)) 98 else if (op->flag [FLAG_CURSED])
99 flags |= F_CURSED; 99 flags |= F_CURSED;
100 } 100 }
101 101
102 if (QUERY_FLAG (op, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (op, FLAG_IDENTIFIED)) 102 if (op->flag [FLAG_KNOWN_MAGICAL] && !op->flag [FLAG_IDENTIFIED])
103 flags |= F_MAGIC; 103 flags |= F_MAGIC;
104 if (QUERY_FLAG (op, FLAG_UNPAID)) 104 if (op->flag [FLAG_UNPAID])
105 flags |= F_UNPAID; 105 flags |= F_UNPAID;
106 if (QUERY_FLAG (op, FLAG_INV_LOCKED)) 106 if (op->flag [FLAG_INV_LOCKED])
107 flags |= F_LOCKED; 107 flags |= F_LOCKED;
108 108
109 return flags; 109 return flags;
110} 110}
111 111
116static void 116static void
117add_object_to_socklist (client &ns, packet &sl, object *head) 117add_object_to_socklist (client &ns, packet &sl, object *head)
118{ 118{
119 int flags = query_flags (head); 119 int flags = query_flags (head);
120 120
121 if (QUERY_FLAG (head, FLAG_NO_PICK)) 121 if (head->flag [FLAG_NO_PICK])
122 flags |= F_NOPICK; 122 flags |= F_NOPICK;
123 123
124 ns.send_face (head->face, -50); 124 ns.send_face (head->face, -50);
125 125
126 if (QUERY_FLAG (head, FLAG_ANIMATE) && !ns.anims_sent[head->animation_id]) 126 if (head->flag [FLAG_ANIMATE] && !ns.anims_sent[head->animation_id])
127 ns.send_animation (head->animation_id); 127 ns.send_animation (head->animation_id);
128 128
129 sl << uint32 (head->count) 129 sl << uint32 (head->count)
130 << uint32 (flags) 130 << uint32 (flags)
131 << uint32 (QUERY_FLAG (head, FLAG_NO_PICK) ? -1 : head->client_weight ()) 131 << uint32 (head->flag [FLAG_NO_PICK] ? -1 : head->client_weight ())
132 << uint32 (head->face); 132 << uint32 (head->face);
133 133
134 if (!head->custom_name) 134 if (!head->custom_name)
135 { 135 {
136 const char *name; 136 const char *name;
193 { 193 {
194 LOG (llevDebug, "esrv_draw_look called when update_look was not set (player %s)\n", &ob->name); 194 LOG (llevDebug, "esrv_draw_look called when update_look was not set (player %s)\n", &ob->name);
195 return; 195 return;
196 } 196 }
197 197
198 if (pl->ns->need_delinv0)
199 {
200 pl->ns->need_delinv0 = 0;
201 pl->ns->send_packet ("delinv 0");
202 }
203
204 if (pl->run_on)
205 return;
206
198 pl->ns->update_look = 0; 207 pl->ns->update_look = 0;
208 pl->ns->need_delinv0 = 1;
199 209
200 if (QUERY_FLAG (ob, FLAG_REMOVED) 210 if (ob->flag [FLAG_REMOVED]
201 || !ob->map 211 || !ob->map
202 || ob->map->in_memory != MAP_ACTIVE 212 || ob->map->in_memory != MAP_ACTIVE
203 || out_of_map (ob->map, ob->x, ob->y)) 213 || out_of_map (ob->map, ob->x, ob->y))
204 return; 214 return;
205
206 pl->ns->send_packet ("delinv 0");
207 215
208 packet sl; 216 packet sl;
209 sl.printf ("item%d ", pl->ns->itemcmd); 217 sl.printf ("item%d ", pl->ns->itemcmd);
210 218
211 sl << uint32 (0); 219 sl << uint32 (0);
448 456
449 if (flags & UPD_ANIMSPEED) 457 if (flags & UPD_ANIMSPEED)
450 { 458 {
451 int anim_speed = 0; 459 int anim_speed = 0;
452 460
453 if (QUERY_FLAG (op, FLAG_ANIMATE)) 461 if (op->flag [FLAG_ANIMATE])
454 { 462 {
455 if (op->anim_speed) 463 if (op->anim_speed)
456 anim_speed = op->anim_speed; 464 anim_speed = op->anim_speed;
457 else 465 else
458 { 466 {
645 pl->failmsg ("Could not find object to lock/unlock"); 653 pl->failmsg ("Could not find object to lock/unlock");
646 return; 654 return;
647 } 655 }
648 656
649 if (!flag) 657 if (!flag)
650 CLEAR_FLAG (op, FLAG_INV_LOCKED); 658 op->clr_flag (FLAG_INV_LOCKED);
651 else 659 else
652 SET_FLAG (op, FLAG_INV_LOCKED); 660 op->set_flag (FLAG_INV_LOCKED);
653 661
654 esrv_update_item (UPD_FLAGS, pl->ob, op); 662 esrv_update_item (UPD_FLAGS, pl->ob, op);
655} 663}
656 664
657/** Client wants to mark some object. Lets do so. */ 665/** Client wants to mark some object. Lets do so. */
718 else 726 else
719 { 727 {
720 if (pos.normalise ()) 728 if (pos.normalise ())
721 for (object *tmp = pos->top; tmp; tmp = tmp->below) 729 for (object *tmp = pos->top; tmp; tmp = tmp->below)
722 { 730 {
723 if (tmp->invisible && !QUERY_FLAG (ob, FLAG_WIZ)) 731 if (tmp->invisible && !ob->flag [FLAG_WIZ])
724 continue; 732 continue;
725 733
726 if (wiz) 734 if (wiz)
727 buf.printf (" - %s (%d) %s\n", query_name (tmp), tmp->count, tmp->uuid.c_str ()); 735 buf.printf (" - %s (%d) %s\n", query_name (tmp), tmp->count, tmp->uuid.c_str ());
728 else 736 else
730 738
731 object *head = tmp->head_ (); 739 object *head = tmp->head_ ();
732 740
733 if (head->inv) 741 if (head->inv)
734 if ((head->type != CONTAINER && head->type != FLESH) 742 if ((head->type != CONTAINER && head->type != FLESH)
735 || QUERY_FLAG (ob, FLAG_WIZ)) 743 || ob->flag [FLAG_WIZ])
736 buf << head->query_inventory (ob, " "); 744 buf << head->query_inventory (ob, " ");
737 745
738 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR) && !wiz) /* don't continue under the floor */ 746 if (tmp->flag [FLAG_IS_FLOOR] && !wiz) /* don't continue under the floor */
739 break; 747 break;
740 } 748 }
741 } 749 }
742 750
743 if (buf.empty ()) 751 if (buf.empty ())
778 return; 786 return;
779 787
780 /* If it is an active container, then we should drop all objects 788 /* If it is an active container, then we should drop all objects
781 * in the container and not the container itself. 789 * in the container and not the container itself.
782 */ 790 */
783 if (op->inv && QUERY_FLAG (op, FLAG_APPLIED)) 791 if (op->inv && op->flag [FLAG_APPLIED])
784 { 792 {
785 int cnt = MAX_ITEM_PER_ACTION; 793 int cnt = MAX_ITEM_PER_ACTION;
786 794
787 for (object *current = op->inv; current && cnt--; ) 795 for (object *current = op->inv; current && cnt--; )
788 { 796 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines