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.24 by root, Sat Dec 16 22:14:42 2006 UTC vs.
Revision 1.27 by root, Wed Dec 20 01:19:11 2006 UTC

214 return; 214 return;
215 215
216 for (tmp = get_map_ob (pl->map, pl->x, pl->y); tmp && tmp->above; tmp = tmp->above) 216 for (tmp = get_map_ob (pl->map, pl->x, pl->y); tmp && tmp->above; tmp = tmp->above)
217 ; 217 ;
218 218
219 pl->contr->socket->send_packet ("delinv 0");
220
219 packet sl; 221 packet sl;
220
221 pl->contr->socket->send_packet ("delinv 0");
222
223 sl.printf ("item%d ", pl->contr->socket->itemcmd); 222 sl.printf ("item%d ", pl->contr->socket->itemcmd);
224 223
225 sl << uint32 (0); 224 sl << uint32 (0);
226 225
227 if (!(pl->contr->socket->faces_sent[empty_face->number] & NS_FACESENT_FACE)) 226 if (!(pl->contr->socket->faces_sent[empty_face->number] & NS_FACESENT_FACE))
228 esrv_send_face (pl->contr->socket, empty_face->number, 0); 227 esrv_send_face (pl->contr->socket, empty_face->number, 0);
229 228
230 if (pl->contr->socket->look_position) 229 if (pl->contr->socket->look_position)
231 { 230 {
232 char buf[80]; 231 char buf[80];
233 snprintf (buf, 80, "Apply this to see %d previous items", NUM_LOOK_OBJECTS); 232 snprintf (buf, 80, "Apply this to see %d previous items", FLOORBOX_PAGESIZE);
234 233
235 sl << uint32 (0x80000000 | (pl->contr->socket->look_position - NUM_LOOK_OBJECTS)) 234 sl << uint32 (0x80000000 | (pl->contr->socket->look_position - FLOORBOX_PAGESIZE))
236 << uint32 (0) 235 << uint32 (0)
237 << sint32 (-1) 236 << sint32 (-1)
238 << uint32 (empty_face->number) 237 << uint32 (empty_face->number)
239 << data8 (buf) 238 << data8 (buf)
240 << uint16 (0) 239 << uint16 (0)
261 if (++start_look < pl->contr->socket->look_position) 260 if (++start_look < pl->contr->socket->look_position)
262 continue; 261 continue;
263 262
264 end_look++; 263 end_look++;
265 264
266 if (end_look > NUM_LOOK_OBJECTS) 265 if (end_look > FLOORBOX_PAGESIZE)
267 { 266 {
268 /* What we basically do is make a 'fake' object - when the user applies it, 267 /* What we basically do is make a 'fake' object - when the user applies it,
269 * we notice the special tag the object has, and act accordingly. 268 * we notice the special tag the object has, and act accordingly.
270 */ 269 */
271 sl << uint32 (0x80000000 | (pl->contr->socket->look_position + NUM_LOOK_OBJECTS)) 270 sl << uint32 (0x80000000 | (pl->contr->socket->look_position + FLOORBOX_PAGESIZE))
272 << uint32 (0) 271 << uint32 (0)
273 << uint32 ((uint32) - 1) 272 << uint32 ((uint32) - 1)
274 << uint32 (empty_face->number) 273 << uint32 (empty_face->number)
275 << data8 ("Apply this to see next group of items") 274 << data8 ("Apply this to see next group of items")
276 << uint16 (0) 275 << uint16 (0)
315esrv_send_inventory (object *pl, object *op) 314esrv_send_inventory (object *pl, object *op)
316{ 315{
317 object *tmp; 316 object *tmp;
318 int got_one = 0; 317 int got_one = 0;
319 318
319
320 pl->contr->socket->send_packet_printf ("delinv %d", op->count);
321
320 packet sl; 322 packet sl;
321
322 sl.printf ("delinv %d", op->count);
323 pl->contr->socket->send_packet (sl);
324
325 sl.reset ();
326 sl.printf ("item%d ", pl->contr->socket->itemcmd); 323 sl.printf ("item%d ", pl->contr->socket->itemcmd);
327 324
328 sl << uint32 (op->count); 325 sl << uint32 (op->count);
329 326
330 for (tmp = op->inv; tmp; tmp = tmp->below) 327 for (tmp = op->inv; tmp; tmp = tmp->below)
391 * and track back the call. 388 * and track back the call.
392 */ 389 */
393 LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count); 390 LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count);
394 } 391 }
395 392
396 packet sl; 393 packet sl ("upditem");
397 394
398 sl << "upditem "
399 << uint8 (flags); 395 sl << uint8 (flags);
400 396
401 if (op->head) 397 if (op->head)
402 op = op->head; 398 op = op->head;
403 399
404 sl << uint32 (op->count); 400 sl << uint32 (op->count);
504 /* if the item is on the ground, mark that the look needs to 500 /* if the item is on the ground, mark that the look needs to
505 * be updated. 501 * be updated.
506 */ 502 */
507 if (!op->env) 503 if (!op->env)
508 { 504 {
509 pl->contr->socket->update_look = 1; 505 pl->contr->socket->floorbox_update ();
510 return; 506 return;
511 } 507 }
512 } 508 }
513 509
514 packet sl; 510 packet sl;
532 */ 528 */
533 529
534void 530void
535esrv_del_item (player *pl, int tag) 531esrv_del_item (player *pl, int tag)
536{ 532{
537 packet sl; 533 packet sl ("delitem");
538 534
539 sl << "delitem "
540 << uint32 (tag); 535 sl << uint32 (tag);
541 536
542 pl->socket->send_packet (sl); 537 pl->socket->send_packet (sl);
543} 538}
544 539
545 540
619 614
620 /* If the high bit is set, player applied a pseudo object. */ 615 /* If the high bit is set, player applied a pseudo object. */
621 if (tag & 0x80000000) 616 if (tag & 0x80000000)
622 { 617 {
623 pl->socket->look_position = tag & 0x7fffffff; 618 pl->socket->look_position = tag & 0x7fffffff;
624 pl->socket->update_look = 1; 619 pl->socket->floorbox_update ();
625 return; 620 return;
626 } 621 }
627 622
628 object *op = esrv_get_ob_from_count (pl->ob, tag); 623 object *op = esrv_get_ob_from_count (pl->ob, tag);
629 624
634 } 629 }
635 630
636 player_apply (pl->ob, op, 0, 0); 631 player_apply (pl->ob, op, 0, 0);
637} 632}
638 633
639/** Client wants to apply some object. Lets do so. */ 634/** Client wants to lock some object. Lets do so. */
640void 635void
641LockItem (char *data, int len, player *pl) 636LockItem (char *data, int len, player *pl)
642{ 637{
643 int flag = data[0]; 638 int flag = data[0];
644 tag_t tag = net_uint32 ((uint8 *)data + 1); 639 tag_t tag = net_uint32 ((uint8 *)data + 1);
656 SET_FLAG (op, FLAG_INV_LOCKED); 651 SET_FLAG (op, FLAG_INV_LOCKED);
657 652
658 esrv_update_item (UPD_FLAGS, pl->ob, op); 653 esrv_update_item (UPD_FLAGS, pl->ob, op);
659} 654}
660 655
661/** Client wants to apply some object. Lets do so. */ 656/** Client wants to mark some object. Lets do so. */
662void 657void
663MarkItem (char *data, int len, player *pl) 658MarkItem (char *data, int len, player *pl)
664{ 659{
665 tag_t tag = net_uint32 ((uint8 *)data); 660 tag_t tag = net_uint32 ((uint8 *)data);
666 object *op = esrv_get_ob_from_count (pl->ob, tag); 661 object *op = esrv_get_ob_from_count (pl->ob, tag);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines