From f7bf56555e56e05dd62893b62f70ada90595a865 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 5 Oct 2019 16:42:13 -0700 Subject: [PATCH] fix pull request #227 - running over engravings Fixes #227 Travel, , all stop on engravings, but told the player what the engraving said and kept going. The message output is buffered until map update or another message, so player couldn't tell where hero was at the time the engraving got shown. Make running stop on engravings. --- doc/fixes36.3 | 6 +++++- src/engrave.c | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 5ea4594cc..0ca806da6 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.124 $ $NHDT-Date: 1570232224 2019/10/04 23:37:04 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.125 $ $NHDT-Date: 1570318925 2019/10/05 23:42:05 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -173,6 +173,10 @@ avoid 'object lost' panic when polymorph causes loss of levitation boots or disrobing/dropping in order to crawl out chooses to drop those boots 'sortloot's attempt to group musical instruments separately from other tools didn't work as intended due to missing 'break' in sortloot_classify() + running told player about engravings as they were being moved + over but buffered output didn't show it until hero stopped, so it + wasn't possible to tell where they were, unlike all other forms of + multiple movement; stop running if/when an engraving is reached Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/engrave.c b/src/engrave.c index d127c4495..a1fa986e4 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 engrave.c $NHDT-Date: 1456304550 2016/02/24 09:02:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.61 $ */ +/* NetHack 3.6 engrave.c $NHDT-Date: 1570318925 2019/10/05 23:42:05 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.75 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -314,7 +314,6 @@ int x, y; { register struct engr *ep = engr_at(x, y); int sensed = 0; - char buf[BUFSZ]; /* Sensing an engraving does not require sight, * nor does it necessarily imply comprehension (literacy). @@ -363,17 +362,22 @@ int x, y; impossible("%s is written in a very strange way.", Something); sensed = 1; } + if (sensed) { - char *et; - unsigned maxelen = BUFSZ - sizeof("You feel the words: \"\". "); - if (strlen(ep->engr_txt) > maxelen) { - (void) strncpy(buf, ep->engr_txt, (int) maxelen); + char *et, buf[BUFSZ]; + int maxelen = (int) (sizeof buf + /* sizeof "literal" counts terminating \0 */ + - sizeof "You feel the words: \"\"."); + + if ((int) strlen(ep->engr_txt) > maxelen) { + (void) strncpy(buf, ep->engr_txt, maxelen); buf[maxelen] = '\0'; et = buf; - } else + } else { et = ep->engr_txt; + } You("%s: \"%s\".", (Blind) ? "feel the words" : "read", et); - if (context.run > 1) + if (context.run > 0) nomul(0); } }