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.47 by root, Tue Jun 5 13:05:03 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
914 return; 908 return;
915 909
916 if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2]) 910 if (pl->blocked_los[dx + pl->ns->mapx / 2][dy + pl->ns->mapy / 2])
917 return; 911 return;
918 912
919 look_at (pl->ob, dx, dy); 913 look_at (pl, dx, dy);
920} 914}
921 915
922/** Move an object to a new location */ 916/** Move an object to a new location */
923void 917void
924esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof) 918esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines