Don't attempt to cache encumber_msg result
There was only one point in the code at which this caching was being done, and it was incorrect: it's possible for the result of near_capacity to change during a monster turn because monster actions can change either inventory weight or carry capacity. The bug was particularly relevant in cases where a character polymorphed into a slow weak monster gets attacked by a monster that moves at normal speed: due to the polyform being slow, the normal-speed monster gets in a lot of attacks and causes a rehumanization, but due to the polyform being weak, it was burdened at the start of the monster turn, and so when that penalty is (due to the bug) applied to the next turn it can mean that the character misses the next turn too, and may end up dying as a result.
This commit is contained in:
10
src/attrib.c
10
src/attrib.c
@@ -191,7 +191,7 @@ adjattrib(
|
||||
if (msgflg <= 0)
|
||||
You_feel("%s%s!", (incr > 1 || incr < -1) ? "very " : "", attrstr);
|
||||
if (program_state.in_moveloop && (ndx == A_STR || ndx == A_CON))
|
||||
(void) encumber_msg();
|
||||
encumber_msg();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ poisoned(
|
||||
/* "Poisoned by a poisoned ___" is redundant */
|
||||
done(strstri(pkiller, "poison") ? DIED : POISONING);
|
||||
}
|
||||
(void) encumber_msg();
|
||||
encumber_msg();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -477,7 +477,7 @@ restore_attrib(void)
|
||||
}
|
||||
}
|
||||
if (disp.botl)
|
||||
(void) encumber_msg();
|
||||
encumber_msg();
|
||||
}
|
||||
|
||||
#define AVAL 50 /* tune value for exercise gains */
|
||||
@@ -511,7 +511,7 @@ exercise(int i, boolean inc_or_dec)
|
||||
(inc_or_dec) ? "inc" : "dec", AEXE(i));
|
||||
}
|
||||
if (svm.moves > 0 && (i == A_STR || i == A_CON))
|
||||
(void) encumber_msg();
|
||||
encumber_msg();
|
||||
}
|
||||
|
||||
staticfn void
|
||||
@@ -753,7 +753,7 @@ redist_attr(void)
|
||||
if (ABASE(i) < ATTRMIN(i))
|
||||
ABASE(i) = ATTRMIN(i);
|
||||
}
|
||||
/* (void) encumber_msg(); -- caller needs to do this */
|
||||
/* encumber_msg(); -- caller needs to do this */
|
||||
}
|
||||
|
||||
/* apply minor variation to attributes */
|
||||
|
||||
Reference in New Issue
Block a user