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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines