iterate all living monsters on current level, calling bfunc for each. if bfunc returns TRUE, stop and return that monster. */
| 4541 | /* iterate all living monsters on current level, calling bfunc for each. |
| 4542 | if bfunc returns TRUE, stop and return that monster. */ |
| 4543 | struct monst * |
| 4544 | get_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. |