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.46 by root, Sun Jun 3 17:05:36 2007 UTC vs.
Revision 1.48 by root, Fri Jun 8 09:18:31 2007 UTC

836 * look_at prints items on the specified square. 836 * look_at prints items on the specified square.
837 * 837 *
838 * [ removed EARTHWALL check and added check for containers inventory. 838 * [ removed EARTHWALL check and added check for containers inventory.
839 * Tero.Haatanen@lut.fi ] 839 * Tero.Haatanen@lut.fi ]
840 */ 840 */
841void 841static void
842look_at (object *op, int dx, int dy) 842look_at (player *pl, int dx, int dy)
843{ 843{
844 object *tmp; 844 object *ob = pl->ob;
845
846 maptile *m = pl->observe->map;
847 sint16 x = pl->observe->x + dx;
848 sint16 y = pl->observe->y + dy;
849
850 if (!xy_normalise (m, x, y))
851 {
852 new_draw_info (NDI_UNIQUE, 0, ob, "You see nothing there.");
853 return;
854 }
855
845 int flag = 0; 856 int flag = 0;
846 sint16 x, y;
847 maptile *m;
848 857
849 x = op->x + dx; 858 for (object *tmp = m->at (x, y).top; tmp; tmp = tmp->below)
850 y = op->y + dy;
851
852 if (out_of_map (op->map, x, y))
853 return;
854
855 m = get_map_from_coord (op->map, &x, &y);
856 if (!m)
857 return;
858
859 for (tmp = GET_MAP_OB (m, x, y); tmp && tmp->above; tmp = tmp->above)
860 ; 859 {
861
862 for (; tmp; tmp = tmp->below)
863 {
864 if (tmp->invisible && !QUERY_FLAG (op, FLAG_WIZ)) 860 if (tmp->invisible && !QUERY_FLAG (ob, FLAG_WIZ))
865 continue; 861 continue;
866 862
867 if (!flag) 863 if (!flag)
868 { 864 {
869 if (dx || dy) 865 if (dx || dy)
870 new_draw_info (NDI_UNIQUE, 0, op, "There you see:"); 866 new_draw_info (NDI_UNIQUE, 0, ob, "There you see:");
871 else 867 else
872 {
873 clear_win_info (op);
874 new_draw_info (NDI_UNIQUE, 0, op, "You see:"); 868 new_draw_info (NDI_UNIQUE, 0, ob, "You see:");
875 } 869
876 flag = 1; 870 flag = 1;
877 } 871 }
878 872
879 if (QUERY_FLAG (op, FLAG_WIZ)) 873 if (QUERY_FLAG (ob, FLAG_WIZ))
880 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s (%d).", query_name (tmp), tmp->count); 874 new_draw_info_format (NDI_UNIQUE, 0, ob, "- %s (%d).", query_name (tmp), tmp->count);
881 else 875 else
882 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s.", query_name (tmp)); 876 new_draw_info_format (NDI_UNIQUE, 0, ob, "- %s.", query_name (tmp));
883 877
884 if (((tmp->inv != NULL || (tmp->head && tmp->head->inv)) && 878 if (((tmp->inv != NULL || (tmp->head && tmp->head->inv)) &&
885 (tmp->type != CONTAINER && tmp->type != FLESH)) || QUERY_FLAG (op, FLAG_WIZ)) 879 (tmp->type != CONTAINER && tmp->type != FLESH)) || QUERY_FLAG (ob, FLAG_WIZ))
886 inventory (op, tmp->head == NULL ? tmp : tmp->head); 880 inventory (ob, tmp->head == NULL ? tmp : tmp->head);
887 881
888 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR) && !QUERY_FLAG (op, FLAG_WIZ)) /* don't continue under the floor */ 882 if (QUERY_FLAG (tmp, FLAG_IS_FLOOR) && !QUERY_FLAG (ob, FLAG_WIZ)) /* don't continue under the floor */
889 break; 883 break;
890 } 884 }
891 885
892 if (!flag) 886 if (!flag)
893 { 887 {
894 if (dx || dy) 888 if (dx || dy)
895 new_draw_info (NDI_UNIQUE, 0, op, "You see nothing there."); 889 new_draw_info (NDI_UNIQUE, 0, ob, "You see nothing there.");
896 else 890 else
897 new_draw_info (NDI_UNIQUE, 0, op, "You see nothing."); 891 new_draw_info (NDI_UNIQUE, 0, ob, "You see nothing.");
898 } 892 }
899} 893}
900 894
901/** Client wants to look at some object. Lets do so. */ 895/** Client wants to look at some object. Lets do so. */
902void 896void
903LookAt (char *buf, int len, player *pl) 897LookAt (char *buf, int len, player *pl)
904{ 898{
905 int dx, dy;
906 char *cp; 899 char *cp;
907 900
908 dx = atoi (buf); 901 int dx = atoi (buf);
909 if (!(cp = strchr (buf, ' '))) 902 if (!(cp = strchr (buf, ' ')))
910 return; 903 return;
911 904
912 dy = atoi (cp); 905 int dy = atoi (cp);
906
907 if (player *opl = pl->observe->contr)
908 if (client *ns = opl->ns)
909 {
913 if (fabs (dx) > pl->ns->mapx / 2 || fabs (dy) > pl->ns->mapy / 2) 910 if (fabs (dx) > ns->mapx / 2 || fabs (dy) > ns->mapy / 2)
914 return; 911 return;
915 912
916 if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2]) 913 if (opl->blocked_los[dx + ns->mapx / 2][dy + ns->mapy / 2])
917 return; 914 return;
915 }
918 916
919 look_at (pl->ob, dx, dy); 917 look_at (pl, dx, dy);
920} 918}
921 919
922/** Move an object to a new location */ 920/** Move an object to a new location */
923void 921void
924esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof) 922esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines