]> granicus.if.org Git - nethack/commitdiff
fix pull request #227 - running over engravings
authorPatR <rankin@nethack.org>
Sat, 5 Oct 2019 23:42:13 +0000 (16:42 -0700)
committerPatR <rankin@nethack.org>
Sat, 5 Oct 2019 23:42:13 +0000 (16:42 -0700)
Fixes #227

Travel, <ctrl><direction>, <g|G><direction> all stop on engravings,
but <shift><direction> 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 <shift> running stop on engravings.

doc/fixes36.3
src/engrave.c

index 5ea4594ccdc2fb7d3130d9951459a2c9556bb309..0ca806da697ce42f8c64f12cc68a8260b217dbac 100644 (file)
@@ -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()
+<shift><letter> 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
index d127c44952b7c916c424f7d85a8c072792ad2685..a1fa986e422a4ca009afd2c77ee5c8b53cd09cba 100644 (file)
@@ -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);
         }
     }