From 4e8880d4fb9bfb46433c5d612aabab68834c7355 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sun, 13 Mar 2005 06:48:35 +0000 Subject: [PATCH] Mr. Izchak Suppress "Mr" or "Ms" title for shopkeepers when they're going by a first name rather than a surname. The bug report was for Izchak, but it would have happened with the two last resort names (which I've never seen in actual use) and for the "hippie names" used in post-3.4.x health food shops. I have not attempted to specify gender for those, just flagged them as first names. This prepends a prefix character to the name string (see comment in shknam.c) to specify gender and/or first name vs surname. --- doc/fixes34.4 | 1 + include/extern.h | 3 ++- src/end.c | 9 +++++--- src/shk.c | 7 ------- src/shknam.c | 54 ++++++++++++++++++++++++++++++++++++------------ 5 files changed, 50 insertions(+), 24 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 104cfe351..efa902022 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -93,6 +93,7 @@ succubi will remove hero's gloves before taking worn ring; incubi will do so before forcing ring to be put on mbodypart should return forehoof, not foreclaw, for horselike monsters further digging of an existing hole finishes in a single turn +only prefix shopkeeper names with "Mr." or "Ms." when not a personal name Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 22a8ec9d7..f63298ec1 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1854,7 +1854,6 @@ E void FDECL(store_savefileinfo, (int)); E long FDECL(money2mon, (struct monst *, long)); E void FDECL(money2u, (struct monst *, long)); #endif -E char *FDECL(shkname, (struct monst *)); E void FDECL(shkgone, (struct monst *)); E void FDECL(set_residency, (struct monst *,BOOLEAN_P)); E void FDECL(replshk, (struct monst *,struct monst *)); @@ -1914,6 +1913,8 @@ E char *FDECL(Shk_Your, (char *,struct obj *)); E void FDECL(stock_room, (int,struct mkroom *)); E boolean FDECL(saleable, (struct monst *,struct obj *)); E int FDECL(get_shop_item, (int)); +E const char *FDECL(shkname, (struct monst *)); +E boolean FDECL(shkname_is_pname, (struct monst *)); /* ### sit.c ### */ diff --git a/src/end.c b/src/end.c index 36290ccb1..de1929d7f 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)end.c 3.5 2004/12/21 */ +/* SCCS Id: @(#)end.c 3.5 2005/03/11 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -218,8 +218,11 @@ register struct monst *mtmp; Strcat(buf, "ghost"); if (mtmp->mnamelth) Sprintf(eos(buf), " of %s", NAME(mtmp)); } else if(mtmp->isshk) { - Sprintf(eos(buf), "%s %s, the shopkeeper", - (mtmp->female ? "Ms." : "Mr."), shkname(mtmp)); + const char *shknm = shkname(mtmp), + *honorific = shkname_is_pname(mtmp) ? "" : + mtmp->female ? "Ms. " : "Mr. "; + + Sprintf(eos(buf), "%s%s, the shopkeeper", honorific, shknm); killer.format = KILLED_BY; } else if (mtmp->ispriest || mtmp->isminion) { /* m_monnam() suppresses "the" prefix plus "invisible", and diff --git a/src/shk.c b/src/shk.c index 060675c13..c1c6cc659 100644 --- a/src/shk.c +++ b/src/shk.c @@ -170,13 +170,6 @@ register boolean withbill; return(shkp); } -char * -shkname(mtmp) /* called in do_name.c */ -register struct monst *mtmp; -{ - return(ESHK(mtmp)->shknam); -} - void shkgone(mtmp) /* called in mon.c */ struct monst *mtmp; diff --git a/src/shknam.c b/src/shknam.c index 1d875956f..32b5c378d 100644 --- a/src/shknam.c +++ b/src/shknam.c @@ -16,6 +16,17 @@ STATIC_DCL int FDECL(shkinit, (const struct shclass *,struct mkroom *)); #define VEGETARIAN_CLASS (MAXOCLASSES+1) +/* + * Name prefix codes: + * dash _ female, personal name + * underscore _ female, general name + * plus + male, personal name + * vertical bar | male, general name (implied for most of shktools) + * equals = gender not specified, personal name + * + * Personal names do not receive the honorific prefix "Mr." or "Ms.". + */ + static const char * const shkliquors[] = { /* Ukraine */ "Njezjin", "Tsjernigof", "Ossipewsk", "Gorlowka", @@ -173,11 +184,11 @@ static const char * const shkhealthfoods[] = { "Ganden", "Tsurphu", "Lhasa", "Tsedong", "Drepung", /* Hippie names */ - "Azura", "Blaze", "Breanna", "Breezy", - "Dharma", "Feather", "Jasmine", "Luna", - "Melody", "Moonjava", "Petal", "Rhiannon", - "Starla", "Tranquilla", "Windsong", "Zennia", - "Zoe", "Zora", + "=Azura", "=Blaze", "=Breanna", "=Breezy", + "=Dharma", "=Feather", "=Jasmine", "=Luna", + "=Melody", "=Moonjava", "=Petal", "=Rhiannon", + "=Starla", "=Tranquilla", "=Windsong", "=Zennia", + "=Zoe", "=Zora", 0 }; @@ -227,10 +238,6 @@ const struct shclass shtypes[] = { {"hardware store", TOOL_CLASS, 3, D_SHOP, {{100, TOOL_CLASS}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, shktools}, - /* Actually shktools is ignored; the code specifically chooses a - * random implementor name (along with candle shops having - * random shopkeepers) - */ {"rare books", SPBOOK_CLASS, 3, D_SHOP, {{90, SPBOOK_CLASS}, {10, SCROLL_CLASS}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, shkbooks}, @@ -395,7 +402,7 @@ const char * const *nlp; if (nlp == shklight && In_mines(&u.uz) && (sptr = Is_special(&u.uz)) != 0 && sptr->flags.town) { /* special-case minetown lighting shk */ - shname = "Izchak"; + shname = "+Izchak"; shk->female = FALSE; } else { /* We want variation from game to game, without needing the save @@ -414,8 +421,7 @@ const char * const *nlp; for (trycnt = 0; trycnt < 50; trycnt++) { if (nlp == shktools) { shname = shktools[rn2(names_avail)]; - shk->female = (*shname == '_'); - if (shk->female) shname++; + shk->female = 0; /* reversed below for '_' prefix */ } else if (name_wanted < names_avail) { shname = nlp[name_wanted]; } else if ((i = rn2(names_avail)) != 0) { @@ -426,8 +432,10 @@ const char * const *nlp; continue; continue; /* next `trycnt' iteration */ } else { - shname = shk->female ? "Lucrezia" : "Dirk"; + shname = shk->female ? "-Lucrezia" : "+Dirk"; } + if (*shname == '_' || *shname == '-') shk->female = 1; + else if (*shname == '|' || *shname == '+') shk->female = 0; /* is name already in use on this level? */ for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { @@ -639,4 +647,24 @@ int type; return shp->iprobs[i].itype; } +const char * +shkname(mtmp) +struct monst *mtmp; +{ + const char *shknm = ESHK(mtmp)->shknam; + + /* strip prefix if present */ + if (!letter(*shknm)) ++shknm; + return shknm; +} + +boolean +shkname_is_pname(mtmp) +struct monst *mtmp; +{ + const char *shknm = ESHK(mtmp)->shknam; + + return (*shknm == '-' || *shknm == '+' || *shknm == '='); +} + /*shknam.c*/