remove a set_uasmon() call from iter_mons() processing

Reported by hackemslashem.
This commit is contained in:
nhmall
2025-02-05 07:57:25 -05:00
parent d611da42cc
commit 0d543a8fae
4 changed files with 11 additions and 2 deletions

View File

@@ -1061,6 +1061,7 @@ struct instance_globals_w {
/* new */
struct win_settings wsettings; /* wintype.h */
long were_changes; /* were.c, allmain.c */
boolean havestate;
unsigned long magic; /* validate that structure layout is preserved */

View File

@@ -201,6 +201,7 @@ moveloop_core(void)
struct monst *mtmp;
/* set up for a new turn */
gw.were_changes = 0L;
mcalcdistress(); /* adjust monsters' trap, blind, etc */
/* reallocate movement rations to monsters; don't need
@@ -324,6 +325,11 @@ moveloop_core(void)
(void) dosearch0(1);
if (Warning)
warnreveal();
if (gw.were_changes) {
/* update innate intrinsics (mainly Drain_resistance) */
set_uasmon();
gw.were_changes = 0L;
}
mkot_trap_warn();
dosounds();
do_storms();

View File

@@ -863,6 +863,7 @@ static const struct instance_globals_w g_init_w = {
UNDEFINED_PTR, /* wportal */
/* new */
{ wdmode_traditional, NO_COLOR }, /* wsettings */
0L, /* were.c, allmain.c */
TRUE, /* havestate*/
IVMAGIC /* w_magic to validate that structure layout has been preserved */
};

View File

@@ -16,6 +16,7 @@ were_change(struct monst *mon)
&& !rn2(night() ? (flags.moonphase == FULL_MOON ? 3 : 30)
: (flags.moonphase == FULL_MOON ? 10 : 50))) {
new_were(mon); /* change into animal form */
gw.were_changes++;
if (!Deaf && !canseemon(mon)) {
const char *howler;
@@ -39,9 +40,8 @@ were_change(struct monst *mon)
}
} else if (!rn2(30) || Protection_from_shape_changers) {
new_were(mon); /* change back into human form */
gw.were_changes++;
}
/* update innate intrinsics (mainly Drain_resistance) */
set_uasmon(); /* new_were() doesn't do this */
}
int
@@ -203,6 +203,7 @@ you_were(void)
return;
}
(void) polymon(u.ulycn);
gw.were_changes++;
}
void