]> granicus.if.org Git - nethack/commitdiff
squeaky board message grammar bit
authorPatR <rankin@nethack.org>
Sun, 31 Jan 2021 00:42:36 +0000 (16:42 -0800)
committerPatR <rankin@nethack.org>
Sun, 31 Jan 2021 00:42:36 +0000 (16:42 -0800)
"You hear a [BCDG] note squeak in the distance" is ok, but
"you hear a [AEF] note squeak in the distance" isn't.

Squeaky board notes already had correct a/an handling but that
particular message explicitly suppressed it.

doc/fixes37.0
src/objnam.c
src/trap.c

index 1a3f56d2ee8fcd7740c3ddb29169347d095526cc..0ac16331906d9982612954892e7aade589ac1b3b 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.437 $ $NHDT-Date: 1611882611 2021/01/29 01:10:11 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.438 $ $NHDT-Date: 1612053751 2021/01/31 00:42:31 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -377,6 +377,7 @@ spells that require a target spot rather than a direction (like skilled
        in the message window while the spell was being performed
 prevent wish request "death wand" from matching Death monster and producing a
        random wand instead of a wand of death
+grammar bit: "you hear a [AEF] note squeak in the distance" (should be "an")
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 244814a9a1a9e0da47b6b843c716ac3e50f685d7..b349af52904cf9dffb5486880963de264b56e229 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 objnam.c        $NHDT-Date: 1611882005 2021/01/29 01:00:05 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.312 $ */
+/* NetHack 3.7 objnam.c        $NHDT-Date: 1612053751 2021/01/31 00:42:31 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.313 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2011. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1675,8 +1675,8 @@ just_an(char *outbuf, const char *str)
 
     *outbuf = '\0';
     c0 = lowc(*str);
-    if (!str[1]) {
-        /* single letter; might be used for named fruit */
+    if (!str[1] || str[1] == ' ') {
+        /* single letter; might be used for named fruit or a musical note */
         Strcpy(outbuf, index("aefhilmnosx", c0) ? "an " : "a ");
     } else if (!strncmpi(str, "the ", 4) || !strcmpi(str, "molten lava")
                || !strcmpi(str, "iron bars") || !strcmpi(str, "ice")) {
index 15955a08e3305b62a294bae7764768f3ec019b6c..d3718cad03ab8d91a3349877febef3b62f85e19f 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 trap.c  $NHDT-Date: 1611182256 2021/01/20 22:37:36 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.398 $ */
+/* NetHack 3.7 trap.c  $NHDT-Date: 1612053752 2021/01/31 00:42:32 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.402 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1132,7 +1132,8 @@ trapeffect_sqky_board(
             seetrap(trap);
             pline("A board beneath you %s%s%s.",
                   Deaf ? "vibrates" : "squeaks ",
-                  Deaf ? "" : trapnote(trap, 0), Deaf ? "" : " loudly");
+                  Deaf ? "" : trapnote(trap, FALSE),
+                  Deaf ? "" : " loudly");
             wake_nearby();
         }
     } else {
@@ -1144,7 +1145,7 @@ trapeffect_sqky_board(
         if (in_sight) {
             if (!Deaf) {
                 pline("A board beneath %s squeaks %s loudly.",
-                      mon_nam(mtmp), trapnote(trap, 0));
+                      mon_nam(mtmp), trapnote(trap, FALSE));
                 seetrap(trap);
             } else {
                 pline("%s stops momentarily and appears to cringe.",
@@ -1155,7 +1156,7 @@ trapeffect_sqky_board(
             int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */
                 ? (BOLT_LIM + 1) : (BOLT_LIM - 3);
 
-            You_hear("a %s squeak %s.", trapnote(trap, 1),
+            You_hear("%s squeak %s.", trapnote(trap, FALSE),
                      (distu(mtmp->mx, mtmp->my) <= range * range)
                      ? "nearby" : "in the distance");
         }
@@ -2453,19 +2454,19 @@ dotrap(register struct trap* trap, unsigned int trflags)
 static char *
 trapnote(struct trap* trap, boolean noprefix)
 {
-    static char tnbuf[12];
-    const char *tn,
-        *tnnames[12] = { "C note",  "D flat", "D note",  "E flat",
-                         "E note",  "F note", "F sharp", "G note",
-                         "G sharp", "A note", "B flat",  "B note" };
+    static const char *const tnnames[] = {
+        "C note",  "D flat", "D note",  "E flat",
+        "E note",  "F note", "F sharp", "G note",
+        "G sharp", "A note", "B flat",  "B note",
+    };
+    static char tnbuf[12]; /* result buffer */
+    const char *tn;
 
     tnbuf[0] = '\0';
     tn = tnnames[trap->tnote];
     if (!noprefix)
-        Sprintf(tnbuf, "%s ",
-                (*tn == 'A' || *tn == 'E' || *tn == 'F') ? "an" : "a");
-    Sprintf(eos(tnbuf), "%s", tn);
-    return tnbuf;
+        (void) just_an(tnbuf, tn);
+    return strcat(tnbuf, tn);
 }
 
 static int