squeaky board message grammar bit

"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.
This commit is contained in:
PatR
2021-01-30 16:42:36 -08:00
parent 143a7b3a06
commit aacea63f7c
3 changed files with 19 additions and 17 deletions
+2 -1
View 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 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 in the message window while the spell was being performed
prevent wish request "death wand" from matching Death monster and producing a prevent wish request "death wand" from matching Death monster and producing a
random wand instead of a wand of death 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 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
+3 -3
View 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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1675,8 +1675,8 @@ just_an(char *outbuf, const char *str)
*outbuf = '\0'; *outbuf = '\0';
c0 = lowc(*str); c0 = lowc(*str);
if (!str[1]) { if (!str[1] || str[1] == ' ') {
/* single letter; might be used for named fruit */ /* single letter; might be used for named fruit or a musical note */
Strcpy(outbuf, index("aefhilmnosx", c0) ? "an " : "a "); Strcpy(outbuf, index("aefhilmnosx", c0) ? "an " : "a ");
} else if (!strncmpi(str, "the ", 4) || !strcmpi(str, "molten lava") } else if (!strncmpi(str, "the ", 4) || !strcmpi(str, "molten lava")
|| !strcmpi(str, "iron bars") || !strcmpi(str, "ice")) { || !strcmpi(str, "iron bars") || !strcmpi(str, "ice")) {
+14 -13
View 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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1132,7 +1132,8 @@ trapeffect_sqky_board(
seetrap(trap); seetrap(trap);
pline("A board beneath you %s%s%s.", pline("A board beneath you %s%s%s.",
Deaf ? "vibrates" : "squeaks ", Deaf ? "vibrates" : "squeaks ",
Deaf ? "" : trapnote(trap, 0), Deaf ? "" : " loudly"); Deaf ? "" : trapnote(trap, FALSE),
Deaf ? "" : " loudly");
wake_nearby(); wake_nearby();
} }
} else { } else {
@@ -1144,7 +1145,7 @@ trapeffect_sqky_board(
if (in_sight) { if (in_sight) {
if (!Deaf) { if (!Deaf) {
pline("A board beneath %s squeaks %s loudly.", pline("A board beneath %s squeaks %s loudly.",
mon_nam(mtmp), trapnote(trap, 0)); mon_nam(mtmp), trapnote(trap, FALSE));
seetrap(trap); seetrap(trap);
} else { } else {
pline("%s stops momentarily and appears to cringe.", 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 */ int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */
? (BOLT_LIM + 1) : (BOLT_LIM - 3); ? (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) (distu(mtmp->mx, mtmp->my) <= range * range)
? "nearby" : "in the distance"); ? "nearby" : "in the distance");
} }
@@ -2453,19 +2454,19 @@ dotrap(register struct trap* trap, unsigned int trflags)
static char * static char *
trapnote(struct trap* trap, boolean noprefix) trapnote(struct trap* trap, boolean noprefix)
{ {
static char tnbuf[12]; static const char *const tnnames[] = {
const char *tn, "C note", "D flat", "D note", "E flat",
*tnnames[12] = { "C note", "D flat", "D note", "E flat", "E note", "F note", "F sharp", "G note",
"E note", "F note", "F sharp", "G note", "G sharp", "A note", "B flat", "B note",
"G sharp", "A note", "B flat", "B note" }; };
static char tnbuf[12]; /* result buffer */
const char *tn;
tnbuf[0] = '\0'; tnbuf[0] = '\0';
tn = tnnames[trap->tnote]; tn = tnnames[trap->tnote];
if (!noprefix) if (!noprefix)
Sprintf(tnbuf, "%s ", (void) just_an(tnbuf, tn);
(*tn == 'A' || *tn == 'E' || *tn == 'F') ? "an" : "a"); return strcat(tnbuf, tn);
Sprintf(eos(tnbuf), "%s", tn);
return tnbuf;
} }
static int static int