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.33 by root, Fri Jan 12 01:29:13 2007 UTC vs.
Revision 1.38 by root, Sat Feb 10 21:01:10 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 }
502 * 502 *
503 * flags is a list of values to update 503 * flags is a list of values to update
504 * 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
505 * same value both places. 505 * same value both places.
506 */ 506 */
507
508void 507void
509esrv_update_item (int flags, object *pl, object *op) 508esrv_update_item (int flags, object *pl, object *op)
510{ 509{
511 /* 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. */
512 if (op != pl) 511 if (op != pl)
604 { 603 {
605 if (op->anim_speed) 604 if (op->anim_speed)
606 anim_speed = op->anim_speed; 605 anim_speed = op->anim_speed;
607 else 606 else
608 { 607 {
609 if (FABS (op->speed) < 0.001) 608 if (fabs (op->speed) < 0.001)
610 anim_speed = 255; 609 anim_speed = 255;
611 else if (FABS (op->speed) >= 1.0) 610 else if (fabs (op->speed) >= 1.0)
612 anim_speed = 1; 611 anim_speed = 1;
613 else 612 else
614 anim_speed = (int) (1.0 / FABS (op->speed)); 613 anim_speed = (int) (1.0 / fabs (op->speed));
615 } 614 }
616 615
617 if (anim_speed > 255) 616 if (anim_speed > 255)
618 anim_speed = 255; 617 anim_speed = 255;
619 } 618 }
631 * Sends item's info to player. 630 * Sends item's info to player.
632 */ 631 */
633void 632void
634esrv_send_item (object *pl, object *op) 633esrv_send_item (object *pl, object *op)
635{ 634{
635 if (!pl->contr->ns)
636 return;
637
636 /* If this is not the player object, do some more checks */ 638 /* If this is not the player object, do some more checks */
637 if (op != pl) 639 if (op != pl)
638 { 640 {
639 /* We only send 'visibile' objects to the client */ 641 /* We only send 'visibile' objects to the client */
640 if (!op->client_visible ()) 642 if (!op->client_visible ())
667 669
668/** 670/**
669 * Tells the client to delete an item. Uses the item 671 * Tells the client to delete an item. Uses the item
670 * command with a -1 location. 672 * command with a -1 location.
671 */ 673 */
672
673void 674void
674esrv_del_item (player *pl, int tag) 675esrv_del_item (player *pl, int tag)
675{ 676{
677 if (!pl->ns)
678 return;
679
676 packet sl ("delitem"); 680 packet sl ("delitem");
677 681
678 sl << uint32 (tag); 682 sl << uint32 (tag);
679 683
680 pl->ns->send_packet (sl); 684 pl->ns->send_packet (sl);
876 else 880 else
877 new_draw_info (NDI_UNIQUE, 0, op, "You see nothing."); 881 new_draw_info (NDI_UNIQUE, 0, op, "You see nothing.");
878 } 882 }
879} 883}
880 884
881
882
883/** Client wants to look at some object. Lets do so. */ 885/** Client wants to look at some object. Lets do so. */
884void 886void
885LookAt (char *buf, int len, player *pl) 887LookAt (char *buf, int len, player *pl)
886{ 888{
887 int dx, dy; 889 int dx, dy;
892 { 894 {
893 return; 895 return;
894 } 896 }
895 dy = atoi (cp); 897 dy = atoi (cp);
896 898
897 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)
898 return; 900 return;
899 901
900 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])
901 return; 903 return;
902 904

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines