From 3f3bec86877807e5679ccb4df3f7485db82f35d5 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 26 Oct 2018 16:35:21 -0700 Subject: [PATCH] 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. --- doc/fixes36.2 | 2 ++ src/eat.c | 8 ++++++-- src/pray.c | 8 ++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index a3e09411a..b9d04e360 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -172,6 +172,8 @@ in Guidebook.mn and Guidebook.txt, the 'I' command mis-described `IX' as displaying inventory items whose bless/curse state is "known" (Guidebook.tex correctly had "unknown") poison gas (stinking cloud) wasn't shown at drawbridge-up spot +prayer result which enhanced strength (fix weakness from hunger) didn't give + a message if a change in encumbrance occurred; it came on next move Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/eat.c b/src/eat.c index 3e74d435f..40c7a4399 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 eat.c $NHDT-Date: 1502754159 2017/08/14 23:42:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.179 $ */ +/* NetHack 3.6 eat.c $NHDT-Date: 1540596900 2018/10/26 23:35:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.193 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -110,14 +110,18 @@ register struct obj *obj; return (boolean) (obj->oclass == FOOD_CLASS); } +/* used for hero init, life saving (if choking), and prayer results of fix + starving, fix weak from hunger, or golden glow boon (if u.uhunger < 900) */ void init_uhunger() { context.botl = (u.uhs != NOT_HUNGRY || ATEMP(A_STR) < 0); u.uhunger = 900; u.uhs = NOT_HUNGRY; - if (ATEMP(A_STR) < 0) + if (ATEMP(A_STR) < 0) { ATEMP(A_STR) = 0; + (void) encumber_msg(); + } } /* tin types [SPINACH_TIN = -1, overrides corpsenm, nut==600] */ diff --git a/src/pray.c b/src/pray.c index 015f9633b..7ad09455a 100644 --- a/src/pray.c +++ b/src/pray.c @@ -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