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

Function get_iter_mons

src/mon.c:4543–4556  ·  view source on GitHub ↗

iterate all living monsters on current level, calling bfunc for each. if bfunc returns TRUE, stop and return that monster. */

Source from the content-addressed store, hash-verified

4541/* iterate all living monsters on current level, calling bfunc for each.
4542 if bfunc returns TRUE, stop and return that monster. */
4543struct monst *
4544get_iter_mons(boolean (*bfunc)(struct monst *))
4545{
4546 struct monst *mtmp, *mtmp2;
4547
4548 for (mtmp = fmon; mtmp; mtmp = mtmp2) {
4549 mtmp2 = mtmp->nmon;
4550 if (DEADMONSTER(mtmp) || mon_offmap(mtmp))
4551 continue;
4552 if ((*bfunc)(mtmp))
4553 break;
4554 }
4555 return mtmp;
4556}
4557
4558/* iterate all living monsters on current level, calling bfunc for each,
4559 passing x,y to the function.

Callers 6

noteleport_levelFunction · 0.85
dosoundsFunction · 0.85
watch_digFunction · 0.85
kick_doorFunction · 0.85
next_to_uFunction · 0.85
dryupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected