iterate all living monsters on current level, calling bfunc for each, passing x,y to the function. if bfunc returns TRUE, stop and return that monster. */
| 4559 | passing x,y to the function. |
| 4560 | if bfunc returns TRUE, stop and return that monster. */ |
| 4561 | struct monst * |
| 4562 | get_iter_mons_xy( |
| 4563 | boolean (*bfunc)(struct monst *, coordxy, coordxy), |
| 4564 | coordxy x, coordxy y) |
| 4565 | { |
| 4566 | struct monst *mtmp, *mtmp2; |
| 4567 | |
| 4568 | for (mtmp = fmon; mtmp; mtmp = mtmp2) { |
| 4569 | mtmp2 = mtmp->nmon; |
| 4570 | if (DEADMONSTER(mtmp) || mon_offmap(mtmp)) |
| 4571 | continue; |
| 4572 | if ((*bfunc)(mtmp, x, y)) |
| 4573 | break; |
| 4574 | } |
| 4575 | return mtmp; |
| 4576 | } |
| 4577 | |
| 4578 | |
| 4579 | /* Heal the given monster by amt hitpoints, unless it is somehow prevented |