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.32 by root, Tue Jan 9 21:32:43 2007 UTC vs.
Revision 1.39 by root, Mon Feb 26 20:36:15 2007 UTC

304 { 304 {
305 if (head->anim_speed) 305 if (head->anim_speed)
306 anim_speed = head->anim_speed; 306 anim_speed = head->anim_speed;
307 else 307 else
308 { 308 {
309 if (FABS (head->speed) < 0.001) 309 if (fabs (head->speed) < 0.001)
310 anim_speed = 255; 310 anim_speed = 255;
311 else if (FABS (head->speed) >= 1.0) 311 else if (fabs (head->speed) >= 1.0)
312 anim_speed = 1; 312 anim_speed = 1;
313 else 313 else
314 anim_speed = (int) (1.0 / FABS (head->speed)); 314 anim_speed = (int) (1.0 / fabs (head->speed));
315 } 315 }
316 316
317 if (anim_speed > 255) 317 if (anim_speed > 255)
318 anim_speed = 255; 318 anim_speed = 255;
319 } 319 }
338 int got_one = 0, start_look = 0, end_look = 0; 338 int got_one = 0, start_look = 0, end_look = 0;
339 char buf[MAX_BUF]; 339 char buf[MAX_BUF];
340 340
341 if (!pl->contr->ns->update_look) 341 if (!pl->contr->ns->update_look)
342 { 342 {
343 LOG (llevDebug, "esrv_draw_look called when update_look was not set\n"); 343 LOG (llevDebug, "esrv_draw_look called when update_look was not set (player %s)\n", &pl->name);
344 return; 344 return;
345 } 345 }
346 else 346 else
347 pl->contr->ns->update_look = 0; 347 pl->contr->ns->update_look = 0;
348 348
448 * Sends whole inventory. 448 * Sends whole inventory.
449 */ 449 */
450void 450void
451esrv_send_inventory (object *pl, object *op) 451esrv_send_inventory (object *pl, object *op)
452{ 452{
453 if (!pl->contr->ns)//D
454 return;
455
453 int got_one = 0; 456 int got_one = 0;
454 457
455 pl->contr->ns->send_packet_printf ("delinv %d", op->count); 458 pl->contr->ns->send_packet_printf ("delinv %d", op->count);
456 459
457 packet sl; 460 packet sl;
499 * 502 *
500 * flags is a list of values to update 503 * flags is a list of values to update
501 * to the client (as defined in newclient.h - might as well use the 504 * to the client (as defined in newclient.h - might as well use the
502 * same value both places. 505 * same value both places.
503 */ 506 */
504
505void 507void
506esrv_update_item (int flags, object *pl, object *op) 508esrv_update_item (int flags, object *pl, object *op)
507{ 509{
508 /* 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. */
509 if (op != pl) 511 if (op != pl)
601 { 603 {
602 if (op->anim_speed) 604 if (op->anim_speed)
603 anim_speed = op->anim_speed; 605 anim_speed = op->anim_speed;
604 else 606 else
605 { 607 {
606 if (FABS (op->speed) < 0.001) 608 if (fabs (op->speed) < 0.001)
607 anim_speed = 255; 609 anim_speed = 255;
608 else if (FABS (op->speed) >= 1.0) 610 else if (fabs (op->speed) >= 1.0)
609 anim_speed = 1; 611 anim_speed = 1;
610 else 612 else
611 anim_speed = (int) (1.0 / FABS (op->speed)); 613 anim_speed = (int) (1.0 / fabs (op->speed));
612 } 614 }
613 615
614 if (anim_speed > 255) 616 if (anim_speed > 255)
615 anim_speed = 255; 617 anim_speed = 255;
616 } 618 }
628 * Sends item's info to player. 630 * Sends item's info to player.
629 */ 631 */
630void 632void
631esrv_send_item (object *pl, object *op) 633esrv_send_item (object *pl, object *op)
632{ 634{
635 if (!pl->contr->ns)
636 return;
637
633 /* If this is not the player object, do some more checks */ 638 /* If this is not the player object, do some more checks */
634 if (op != pl) 639 if (op != pl)
635 { 640 {
636 /* We only send 'visibile' objects to the client */ 641 /* We only send 'visibile' objects to the client */
637 if (!op->client_visible ()) 642 if (!op->client_visible ())
664 669
665/** 670/**
666 * Tells the client to delete an item. Uses the item 671 * Tells the client to delete an item. Uses the item
667 * command with a -1 location. 672 * command with a -1 location.
668 */ 673 */
669
670void 674void
671esrv_del_item (player *pl, int tag) 675esrv_del_item (player *pl, int tag)
672{ 676{
677 if (!pl->ns)
678 return;
679
673 packet sl ("delitem"); 680 packet sl ("delitem");
674 681
675 sl << uint32 (tag); 682 sl << uint32 (tag);
676 683
677 pl->ns->send_packet (sl); 684 pl->ns->send_packet (sl);
873 else 880 else
874 new_draw_info (NDI_UNIQUE, 0, op, "You see nothing."); 881 new_draw_info (NDI_UNIQUE, 0, op, "You see nothing.");
875 } 882 }
876} 883}
877 884
878
879
880/** Client wants to look at some object. Lets do so. */ 885/** Client wants to look at some object. Lets do so. */
881void 886void
882LookAt (char *buf, int len, player *pl) 887LookAt (char *buf, int len, player *pl)
883{ 888{
884 int dx, dy; 889 int dx, dy;
889 { 894 {
890 return; 895 return;
891 } 896 }
892 dy = atoi (cp); 897 dy = atoi (cp);
893 898
894 if (FABS (dx) > pl->ns->mapx / 2 || FABS (dy) > pl->ns->mapy / 2) 899 if (fabs (dx) > pl->ns->mapx / 2 || fabs (dy) > pl->ns->mapy / 2)
895 return; 900 return;
896 901
897 if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2]) 902 if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2])
898 return; 903 return;
899 904

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines