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.34 by root, Mon Jan 15 02:39:41 2007 UTC vs.
Revision 1.40 by pippijn, Thu Mar 1 12:28:17 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 }
334 */ 334 */
335void 335void
336esrv_draw_look (object *pl) 336esrv_draw_look (object *pl)
337{ 337{
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];
340 339
341 if (!pl->contr->ns->update_look) 340 if (!pl->contr->ns->update_look)
342 { 341 {
343 LOG (llevDebug, "esrv_draw_look called when update_look was not set\n"); 342 LOG (llevDebug, "esrv_draw_look called when update_look was not set (player %s)\n", &pl->name);
344 return; 343 return;
345 } 344 }
346 else 345 else
347 pl->contr->ns->update_look = 0; 346 pl->contr->ns->update_look = 0;
348 347
502 * 501 *
503 * flags is a list of values to update 502 * flags is a list of values to update
504 * to the client (as defined in newclient.h - might as well use the 503 * to the client (as defined in newclient.h - might as well use the
505 * same value both places. 504 * same value both places.
506 */ 505 */
507
508void 506void
509esrv_update_item (int flags, object *pl, object *op) 507esrv_update_item (int flags, object *pl, object *op)
510{ 508{
511 /* If we have a request to send the player item, skip a few checks. */ 509 /* If we have a request to send the player item, skip a few checks. */
512 if (op != pl) 510 if (op != pl)
604 { 602 {
605 if (op->anim_speed) 603 if (op->anim_speed)
606 anim_speed = op->anim_speed; 604 anim_speed = op->anim_speed;
607 else 605 else
608 { 606 {
609 if (FABS (op->speed) < 0.001) 607 if (fabs (op->speed) < 0.001)
610 anim_speed = 255; 608 anim_speed = 255;
611 else if (FABS (op->speed) >= 1.0) 609 else if (fabs (op->speed) >= 1.0)
612 anim_speed = 1; 610 anim_speed = 1;
613 else 611 else
614 anim_speed = (int) (1.0 / FABS (op->speed)); 612 anim_speed = (int) (1.0 / fabs (op->speed));
615 } 613 }
616 614
617 if (anim_speed > 255) 615 if (anim_speed > 255)
618 anim_speed = 255; 616 anim_speed = 255;
619 } 617 }
670 668
671/** 669/**
672 * Tells the client to delete an item. Uses the item 670 * Tells the client to delete an item. Uses the item
673 * command with a -1 location. 671 * command with a -1 location.
674 */ 672 */
675
676void 673void
677esrv_del_item (player *pl, int tag) 674esrv_del_item (player *pl, int tag)
678{ 675{
676 if (!pl->ns)
677 return;
678
679 packet sl ("delitem"); 679 packet sl ("delitem");
680 680
681 sl << uint32 (tag); 681 sl << uint32 (tag);
682 682
683 pl->ns->send_packet (sl); 683 pl->ns->send_packet (sl);
879 else 879 else
880 new_draw_info (NDI_UNIQUE, 0, op, "You see nothing."); 880 new_draw_info (NDI_UNIQUE, 0, op, "You see nothing.");
881 } 881 }
882} 882}
883 883
884
885
886/** Client wants to look at some object. Lets do so. */ 884/** Client wants to look at some object. Lets do so. */
887void 885void
888LookAt (char *buf, int len, player *pl) 886LookAt (char *buf, int len, player *pl)
889{ 887{
890 int dx, dy; 888 int dx, dy;
895 { 893 {
896 return; 894 return;
897 } 895 }
898 dy = atoi (cp); 896 dy = atoi (cp);
899 897
900 if (FABS (dx) > pl->ns->mapx / 2 || FABS (dy) > pl->ns->mapy / 2) 898 if (fabs (dx) > pl->ns->mapx / 2 || fabs (dy) > pl->ns->mapy / 2)
901 return; 899 return;
902 900
903 if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2]) 901 if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2])
904 return; 902 return;
905 903

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines