hit all objects at x,y with fhito function */
| 1704 | |
| 1705 | /* hit all objects at x,y with fhito function */ |
| 1706 | staticfn boolean |
| 1707 | fhito_loc(struct obj *obj, |
| 1708 | coordxy tx, coordxy ty, |
| 1709 | int (*fhito)(OBJ_P, OBJ_P)) |
| 1710 | { |
| 1711 | struct obj *otmp, *next_obj; |
| 1712 | int hitanything = 0; |
| 1713 | |
| 1714 | if (!fhito || !OBJ_AT(tx, ty)) |
| 1715 | return FALSE; |
| 1716 | |
| 1717 | for (otmp = svl.level.objects[tx][ty]; otmp; otmp = next_obj) { |
| 1718 | next_obj = otmp->nexthere; |
| 1719 | |
| 1720 | if (otmp->where != OBJ_FLOOR || otmp->ox != tx || otmp->oy != ty) |
| 1721 | continue; |
| 1722 | hitanything += (*fhito)(otmp, obj); |
| 1723 | } |
| 1724 | |
| 1725 | return hitanything ? TRUE : FALSE; |
| 1726 | } |
| 1727 | |
| 1728 | /* A modified bhit() for monsters. Based on bhit() in zap.c. Unlike |
| 1729 | * buzz(), bhit() doesn't take into account the possibility of a monster |