From: PatR Date: Mon, 6 Jun 2022 23:15:07 +0000 (-0700) Subject: artifact name formatting bit X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1d0f1103c27cf5bb2459dc91754aada080e9428;p=nethack artifact name formatting bit All the quest artifacts are named "The of ". Change xname() to force "the" instead of "The" when that occurs in the middle of "a skeleton key named The Master Key of Thievery" or "a pair of lenses named The Eyes of the Overworld". This change isn't applied to user-assigned names; they're used as-is. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 7846e5838..f3851592b 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1,4 +1,4 @@ -HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.933 $ $NHDT-Date: 1654205933 2022/06/02 21:38:53 $ +HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.939 $ $NHDT-Date: 1654557302 2022/06/06 23:15:02 $ General Fixes and Modified Features ----------------------------------- @@ -917,6 +917,8 @@ if player gave a subset count when removing an item from a container, then got stacks of gold inside a container two-handed weapon message stated "welds to monster's hand" instead of "welds to monster's hands" +when formatting an object, avoid capitalization of "The" in " named + The " Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/objnam.c b/src/objnam.c index c17765cee..c6baa6664 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 objnam.c $NHDT-Date: 1654200083 2022/06/02 20:01:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.366 $ */ +/* NetHack 3.7 objnam.c $NHDT-Date: 1654557302 2022/06/06 23:15:02 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.368 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -501,8 +501,8 @@ xname_flags( { register char *buf; char *obufp; - register int typ = obj->otyp; - register struct objclass *ocl = &objects[typ]; + int typ = obj->otyp; + struct objclass *ocl = &objects[typ]; int nn = ocl->oc_name_known, omndx = obj->corpsenm; const char *actualn = OBJ_NAME(*ocl); const char *dn = OBJ_DESCR(*ocl); @@ -873,7 +873,11 @@ xname_flags( if (has_oname(obj) && dknown) { Strcat(buf, " named "); nameit: + obufp = eos(buf); Strcat(buf, ONAME(obj)); + /* downcase "The" in " named The ..." */ + if (obj->oartifact && !strncmp(obufp, "The ", 4)) + *obufp = lowc(*obufp); /* = 't'; */ } if (!strncmpi(buf, "the ", 4))