Monster list iterator

Add some basic functions to iterate through the monster list,
ignoring dead monsters. Mainly just to allow splitting up code
into discrete functions.

Not quite happy with the get_iter_mons_xy - should probably have
a pointer to iterator data struct, which gets passed through instead,
but this works for now.
This commit is contained in:
Pasi Kallinen
2022-04-24 13:03:43 +03:00
parent f886e0d6ce
commit 4a01c8fbd7
10 changed files with 418 additions and 309 deletions

View File

@@ -1839,14 +1839,8 @@ maybe_lvltport_feedback(void)
static void
final_level(void)
{
struct monst *mtmp;
/* reset monster hostility relative to player */
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
continue;
reset_hostility(mtmp);
}
iter_mons(reset_hostility);
/* create some player-monsters */
create_mplayers(rn1(4, 3), TRUE);