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:
@@ -1657,7 +1657,7 @@ shrink_glob(
|
||||
}
|
||||
if (updinv) {
|
||||
update_inventory();
|
||||
(void) encumber_msg();
|
||||
encumber_msg();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2892,7 +2892,7 @@ hornoplenty(
|
||||
/* item still in magic horn was weightless; when it's now in
|
||||
a carried container, hero's encumbrance could change */
|
||||
if (carried(targetbox)) {
|
||||
(void) encumber_msg();
|
||||
encumber_msg();
|
||||
update_inventory(); /* for contents count or wizweight */
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user