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:
6
src/do.c
6
src/do.c
@@ -839,7 +839,7 @@ dropz(struct obj *obj, boolean with_impact)
|
||||
map_object(obj, 0);
|
||||
newsym(u.ux, u.uy); /* remap location under self */
|
||||
}
|
||||
(void) encumber_msg();
|
||||
encumber_msg();
|
||||
}
|
||||
|
||||
/* when swallowed, move dropped object from OBJ_FREE to u.ustuck's inventory;
|
||||
@@ -2431,7 +2431,7 @@ set_wounded_legs(long side, int timex)
|
||||
direct assignment instead of bitwise-OR so getting wounded in
|
||||
one leg mysteriously healed the other */
|
||||
EWounded_legs |= side;
|
||||
(void) encumber_msg();
|
||||
encumber_msg();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2470,7 +2470,7 @@ heal_legs(
|
||||
more when steed becomes healthy, then possible floor
|
||||
feedback, then able to carry less when back on foot]. */
|
||||
if (how == 0)
|
||||
(void) encumber_msg();
|
||||
encumber_msg();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user