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.15 by root, Thu Dec 14 01:12:35 2006 UTC vs.
Revision 1.16 by root, Thu Dec 14 01:21:58 2006 UTC

109 flags |= F_LOCKED; 109 flags |= F_LOCKED;
110 110
111 return flags; 111 return flags;
112} 112}
113 113
114/* Used in the send_look to put object head into SockList 114/* Used in the send_look to put object head into packet
115 * sl for socket ns. Need socket to know if we need to send 115 * sl for socket ns. Need socket to know if we need to send
116 * animation of face to the client. 116 * animation of face to the client.
117 */ 117 */
118static void 118static void
119add_object_to_socklist (NewSocket &ns, SockList &sl, object *head) 119add_object_to_socklist (NewSocket &ns, packet &sl, object *head)
120{ 120{
121 int flags, len, anim_speed; 121 int flags, len, anim_speed;
122 char item_n[MAX_BUF]; 122 char item_n[MAX_BUF];
123 const char *item_p; 123 const char *item_p;
124 124
216 return; 216 return;
217 217
218 for (tmp = get_map_ob (pl->map, pl->x, pl->y); tmp && tmp->above; tmp = tmp->above) 218 for (tmp = get_map_ob (pl->map, pl->x, pl->y); tmp && tmp->above; tmp = tmp->above)
219 ; 219 ;
220 220
221 SockList sl (MAXSOCKBUF); 221 packet sl;
222 222
223 pl->contr->socket.send_packet ("delinv 0"); 223 pl->contr->socket.send_packet ("delinv 0");
224 224
225 sl.printf ("item%d ", pl->contr->socket.itemcmd); 225 sl.printf ("item%d ", pl->contr->socket.itemcmd);
226 226
307 } 307 }
308 308
309 if (got_one) 309 if (got_one)
310 Send_With_Handling (&pl->contr->socket, &sl); 310 Send_With_Handling (&pl->contr->socket, &sl);
311 311
312 sl.free ();
313} 312}
314 313
315/** 314/**
316 * Sends whole inventory. 315 * Sends whole inventory.
317 */ 316 */
319esrv_send_inventory (object *pl, object *op) 318esrv_send_inventory (object *pl, object *op)
320{ 319{
321 object *tmp; 320 object *tmp;
322 int got_one = 0; 321 int got_one = 0;
323 322
324 SockList sl (MAXSOCKBUF); 323 packet sl;
325 324
326 sl.printf ("delinv %d", op->count); 325 sl.printf ("delinv %d", op->count);
327 Send_With_Handling (&pl->contr->socket, &sl); 326 Send_With_Handling (&pl->contr->socket, &sl);
328 327
329 sl.reset (); 328 sl.reset ();
362 } 361 }
363 362
364 if (got_one) 363 if (got_one)
365 Send_With_Handling (&pl->contr->socket, &sl); 364 Send_With_Handling (&pl->contr->socket, &sl);
366 365
367 sl.free ();
368} 366}
369 367
370/** 368/**
371 * Updates object *op for player *pl. 369 * Updates object *op for player *pl.
372 * 370 *
396 * and track back the call. 394 * and track back the call.
397 */ 395 */
398 LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count); 396 LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count);
399 } 397 }
400 398
401 SockList sl (MAXSOCKBUF); 399 packet sl;
402 400
403 sl << "upditem " 401 sl << "upditem "
404 << uint8 (flags); 402 << uint8 (flags);
405 403
406 if (op->head) 404 if (op->head)
490 488
491 if (flags & UPD_NROF) 489 if (flags & UPD_NROF)
492 sl << uint32 (op->nrof); 490 sl << uint32 (op->nrof);
493 491
494 Send_With_Handling (&pl->contr->socket, &sl); 492 Send_With_Handling (&pl->contr->socket, &sl);
495 sl.free ();
496} 493}
497 494
498/** 495/**
499 * Sends item's info to player. 496 * Sends item's info to player.
500 */ 497 */
515 pl->contr->socket.update_look = 1; 512 pl->contr->socket.update_look = 1;
516 return; 513 return;
517 } 514 }
518 } 515 }
519 516
520 SockList sl (MAXSOCKBUF); 517 packet sl;
521 518
522 sl.printf ("item%d ", pl->contr->socket.itemcmd); 519 sl.printf ("item%d ", pl->contr->socket.itemcmd);
523 520
524 if (op->head) 521 if (op->head)
525 op = op->head; 522 op = op->head;
529 add_object_to_socklist (pl->contr->socket, sl, op); 526 add_object_to_socklist (pl->contr->socket, sl, op);
530 527
531 Send_With_Handling (&pl->contr->socket, &sl); 528 Send_With_Handling (&pl->contr->socket, &sl);
532 SET_FLAG (op, FLAG_CLIENT_SENT); 529 SET_FLAG (op, FLAG_CLIENT_SENT);
533 530
534 sl.free ();
535} 531}
536 532
537/** 533/**
538 * Tells the client to delete an item. Uses the item 534 * Tells the client to delete an item. Uses the item
539 * command with a -1 location. 535 * command with a -1 location.
540 */ 536 */
541 537
542void 538void
543esrv_del_item (player *pl, int tag) 539esrv_del_item (player *pl, int tag)
544{ 540{
545 SockList sl (MAXSOCKBUF); 541 packet sl;
546 542
547 sl << "delitem " 543 sl << "delitem "
548 << uint32 (tag); 544 << uint32 (tag);
549 545
550 Send_With_Handling (&pl->socket, &sl); 546 Send_With_Handling (&pl->socket, &sl);
551 sl.free ();
552} 547}
553 548
554 549
555/******************************************************************************* 550/*******************************************************************************
556 * 551 *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines