MCPcopy Create free account
hub / github.com/NetHack/NetHack / fhito_loc

Function fhito_loc

src/muse.c:1706–1726  ·  view source on GitHub ↗

hit all objects at x,y with fhito function */

Source from the content-addressed store, hash-verified

1704
1705/* hit all objects at x,y with fhito function */
1706staticfn boolean
1707fhito_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

Callers 1

mbhitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected