version 1.13 | | version 1.14 |
---|
| | |
| | |
/* | | /* |
* static char *rcsid_item_c = | | * static char *rcsid_item_c = |
* "$Id: item.c,v 1.13 2001/04/27 05:04:07 mwedel Exp $"; | | * "$Id: item.c,v 1.14 2001/05/02 07:26:51 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
void look_at(object *op,int dx,int dy) { | | void look_at(object *op,int dx,int dy) { |
object *tmp; | | object *tmp; |
char buf[MAX_BUF]; | | |
int flag=0; | | int flag=0; |
| | |
if (out_of_map(op->map, op->x+dx, op->y+dy)) return; | | if (out_of_map(op->map, op->x+dx, op->y+dy)) return; |
| | /* put player back on top */ |
if(op->above!=NULL) { | | if(op->above!=NULL) { |
SET_FLAG (op, FLAG_NO_APPLY); | | SET_FLAG (op, FLAG_NO_APPLY); |
remove_ob(op); | | remove_ob(op); |
insert_ob_in_map(op,op->map,NULL); | | insert_ob_in_map(op,op->map,NULL); |
CLEAR_FLAG (op, FLAG_NO_APPLY); | | CLEAR_FLAG (op, FLAG_NO_APPLY); |
} | | } |
| | /* find top object to process from */ |
if(dx||dy) | | if(dx||dy) |
for(tmp=get_map_ob(op->map,op->x+dx,op->y+dy);tmp!=NULL&&tmp->above!=NULL; | | for(tmp=get_map_ob(op->map,op->x+dx,op->y+dy);tmp!=NULL&&tmp->above!=NULL; |
tmp=tmp->above); | | tmp=tmp->above); |
else | | else |
tmp=op->below; | | tmp=op->below; |
while(tmp && (QUERY_FLAG(op, FLAG_WIZ) ||(!tmp->invisible && tmp!=op))) { | | |
| | for ( ; tmp != NULL; tmp=tmp->below ) { |
| | if (tmp->invisible && !QUERY_FLAG(op, FLAG_WIZ)) continue; |
| | |
if(!flag) { | | if(!flag) { |
if(dx||dy) | | if(dx||dy) |
new_draw_info(NDI_UNIQUE, 0,op,"There you see:"); | | new_draw_info(NDI_UNIQUE, 0,op,"There you see:"); |
| | |
} | | } |
flag=1; | | flag=1; |
} | | } |
| | |
if(QUERY_FLAG(op, FLAG_WIZ)) | | if(QUERY_FLAG(op, FLAG_WIZ)) |
(void) sprintf(buf,"- %s (%d).",query_name(tmp),tmp->count); | | new_draw_info_format(NDI_UNIQUE,0, op, "- %s (%d).",query_name(tmp),tmp->count); |
else | | else |
(void) sprintf(buf,"- %s.",query_name(tmp)); | | new_draw_info_format(NDI_UNIQUE,0, op, "- %s.",query_name(tmp)); |
new_draw_info(NDI_UNIQUE, 0,op,buf); | | |
if((tmp->inv!=NULL || (tmp->head && tmp->head->inv)) && | | if((tmp->inv!=NULL || (tmp->head && tmp->head->inv)) && |
( (!dx&&!dy) || tmp->type != CONTAINER || QUERY_FLAG(op, FLAG_WIZ) | | ( (!dx&&!dy) || tmp->type != CONTAINER || QUERY_FLAG(op, FLAG_WIZ) |
/* added some cases here -b.t. */ | | |
|| !(tmp->type) || tmp->type!=FLESH )) | | || !(tmp->type) || tmp->type!=FLESH )) |
inventory(op,tmp->head==NULL?tmp:tmp->head); | | inventory(op,tmp->head==NULL?tmp:tmp->head); |
| | |
if(QUERY_FLAG(tmp, FLAG_IS_FLOOR)&&!QUERY_FLAG(op, FLAG_WIZ)) /* don't continue under the floor */ | | if(QUERY_FLAG(tmp, FLAG_IS_FLOOR)&&!QUERY_FLAG(op, FLAG_WIZ)) /* don't continue under the floor */ |
break; | | break; |
tmp=tmp->below; | | |
} | | } |
| | |
if(!flag) { | | if(!flag) { |
if(dx||dy) | | if(dx||dy) |
new_draw_info(NDI_UNIQUE, 0,op,"You see nothing there."); | | new_draw_info(NDI_UNIQUE, 0,op,"You see nothing there."); |