fix github issue #150 - delayed encumbrance msg

Fixes #150

> A very minor one, but there are some situations where your encumbrance
> level can change, but the message (such as '`Your movements are now
> unencumbered.`') isn't given until your next move or turn, even though
> the status line updates immediately.  For example, praying while weak
> and gaining a point of strength.  Picking up or dropping items or
> interacting with containers does _not_ have this problem.

This is usually fixed on a case by case basis.  Any attempt to add
blanket encumbrance check mid-turn (when updating status, for instance)
is sure to introduce message sequencing problems.  Perhaps such a check
could be added at the end of the hero's move....

This fix handles the cases where prayer causes a change to strength:
major: fix starvation, minor: fix weak from hunger, boon: golden glow
(restore strength and satisfy hunger--probably no-ops in this regard
or would have had trouble fixed rather than receive a boon).  Directly
curing stat loss (minor: poisoned) already dealt with encumbrance.

> Possibly related to the quirk whereby polymorphing into a form with
> different speed gives you one move movement at your old speed?
> (Polymorphing into a sessile monster gives you one last move.)

Not at all related.  That movement bug affected 3.6.0 but was fixed in
3.6.1.
This commit is contained in:
PatR
2018-10-26 16:35:21 -07:00
parent 2986a807de
commit 3f3bec8687
3 changed files with 14 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pray.c $NHDT-Date: 1539804904 2018/10/17 19:35:04 $ $NHDT-Branch: keni-makedefsm $:$NHDT-Revision: 1.103 $ */
/* NetHack 3.6 pray.c $NHDT-Date: 1540596912 2018/10/26 23:35:12 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.104 $ */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1074,7 +1074,11 @@ aligntyp g_align;
u.uhp = u.uhpmax;
if (Upolyd)
u.mh = u.mhmax;
ABASE(A_STR) = AMAX(A_STR);
if (ABASE(A_STR) < AMAX(A_STR)) {
ABASE(A_STR) = AMAX(A_STR);
context.botl = 1; /* before potential message */
(void) encumber_msg();
}
if (u.uhunger < 900)
init_uhunger();
/* luck couldn't have been negative at start of prayer because