Merge branch 'NetHack-3.6.2-beta01' into NetHack-3.6.2
This commit is contained in:
93
src/objnam.c
93
src/objnam.c
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 objnam.c $NHDT-Date: 1543745355 2018/12/02 10:09:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.227 $ */
|
/* NetHack 3.6 objnam.c $NHDT-Date: 1544492043 2018/12/11 01:34:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.229 $ */
|
||||||
/* 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. */
|
||||||
@@ -19,6 +19,7 @@ STATIC_DCL void FDECL(releaseobuf, (char *));
|
|||||||
STATIC_DCL char *FDECL(minimal_xname, (struct obj *));
|
STATIC_DCL char *FDECL(minimal_xname, (struct obj *));
|
||||||
STATIC_DCL void FDECL(add_erosion_words, (struct obj *, char *));
|
STATIC_DCL void FDECL(add_erosion_words, (struct obj *, char *));
|
||||||
STATIC_DCL char *FDECL(doname_base, (struct obj *obj, unsigned));
|
STATIC_DCL char *FDECL(doname_base, (struct obj *obj, unsigned));
|
||||||
|
STATIC_DCL char *FDECL(just_an, (char *str, const char *));
|
||||||
STATIC_DCL boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P,
|
STATIC_DCL boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P,
|
||||||
const char *const *));
|
const char *const *));
|
||||||
STATIC_DCL char *FDECL(singplur_compound, (char *));
|
STATIC_DCL char *FDECL(singplur_compound, (char *));
|
||||||
@@ -476,11 +477,12 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
|||||||
Strcat(buf, un);
|
Strcat(buf, un);
|
||||||
} else
|
} else
|
||||||
Strcat(buf, dn);
|
Strcat(buf, dn);
|
||||||
/* If we use an() here we'd have to remember never to use */
|
|
||||||
/* it whenever calling doname() or xname(). */
|
|
||||||
if (typ == FIGURINE && omndx != NON_PM) {
|
if (typ == FIGURINE && omndx != NON_PM) {
|
||||||
Sprintf(eos(buf), " of a%s %s",
|
char anbuf[10]; /* [4] would be enough: 'a','n',' ','\0' */
|
||||||
index(vowels, *mons[omndx].mname) ? "n" : "",
|
|
||||||
|
Sprintf(eos(buf), " of %s%s",
|
||||||
|
just_an(anbuf, mons[omndx].mname),
|
||||||
mons[omndx].mname);
|
mons[omndx].mname);
|
||||||
} else if (is_wet_towel(obj)) {
|
} else if (is_wet_towel(obj)) {
|
||||||
if (wizard)
|
if (wizard)
|
||||||
@@ -506,9 +508,9 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nn)
|
if (nn) {
|
||||||
Strcat(buf, actualn);
|
Strcat(buf, actualn);
|
||||||
else if (un) {
|
} else if (un) {
|
||||||
if (is_boots(obj))
|
if (is_boots(obj))
|
||||||
Strcat(buf, "boots");
|
Strcat(buf, "boots");
|
||||||
else if (is_gloves(obj))
|
else if (is_gloves(obj))
|
||||||
@@ -567,7 +569,9 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
|||||||
Strcpy(buf, actualn);
|
Strcpy(buf, actualn);
|
||||||
break;
|
break;
|
||||||
case ROCK_CLASS:
|
case ROCK_CLASS:
|
||||||
if (typ == STATUE && omndx != NON_PM)
|
if (typ == STATUE && omndx != NON_PM) {
|
||||||
|
char anbuf[10];
|
||||||
|
|
||||||
Sprintf(buf, "%s%s of %s%s",
|
Sprintf(buf, "%s%s of %s%s",
|
||||||
(Role_if(PM_ARCHEOLOGIST) && (obj->spe & STATUE_HISTORIC))
|
(Role_if(PM_ARCHEOLOGIST) && (obj->spe & STATUE_HISTORIC))
|
||||||
? "historic "
|
? "historic "
|
||||||
@@ -577,11 +581,9 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
|||||||
? ""
|
? ""
|
||||||
: the_unique_pm(&mons[omndx])
|
: the_unique_pm(&mons[omndx])
|
||||||
? "the "
|
? "the "
|
||||||
: index(vowels, *mons[omndx].mname)
|
: just_an(anbuf, mons[omndx].mname),
|
||||||
? "an "
|
|
||||||
: "a ",
|
|
||||||
mons[omndx].mname);
|
mons[omndx].mname);
|
||||||
else
|
} else
|
||||||
Strcpy(buf, actualn);
|
Strcpy(buf, actualn);
|
||||||
break;
|
break;
|
||||||
case BALL_CLASS:
|
case BALL_CLASS:
|
||||||
@@ -1213,14 +1215,13 @@ unsigned doname_flags;
|
|||||||
if (price > 0)
|
if (price > 0)
|
||||||
Sprintf(eos(bp), " (%ld %s)", price, currency(price));
|
Sprintf(eos(bp), " (%ld %s)", price, currency(price));
|
||||||
}
|
}
|
||||||
if (!strncmp(prefix, "a ", 2)
|
if (!strncmp(prefix, "a ", 2)) {
|
||||||
&& index(vowels, *(prefix + 2) ? *(prefix + 2) : *bp)
|
/* save current prefix, without "a "; might be empty */
|
||||||
&& (*(prefix + 2)
|
Strcpy(tmpbuf, prefix + 2);
|
||||||
|| (strncmp(bp, "uranium", 7) && strncmp(bp, "unicorn", 7)
|
/* set prefix[] to "", "a ", or "an " */
|
||||||
&& strncmp(bp, "eucalyptus", 10)))) {
|
(void) just_an(prefix, *tmpbuf ? tmpbuf : bp);
|
||||||
Strcpy(tmpbuf, prefix);
|
/* apprend remainder of original prefix */
|
||||||
Strcpy(prefix, "an ");
|
Strcat(prefix, tmpbuf);
|
||||||
Strcpy(prefix + 3, tmpbuf + 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* show weight for items (debug tourist info)
|
/* show weight for items (debug tourist info)
|
||||||
@@ -1590,26 +1591,46 @@ char *FDECL((*func), (OBJ_P));
|
|||||||
return nam;
|
return nam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* pick "", "a ", or "an " as article for 'str'; used by an() and doname() */
|
||||||
|
STATIC_OVL char *
|
||||||
|
just_an(outbuf, str)
|
||||||
|
char *outbuf;
|
||||||
|
const char *str;
|
||||||
|
{
|
||||||
|
char c0;
|
||||||
|
|
||||||
|
*outbuf = '\0';
|
||||||
|
c0 = lowc(*str);
|
||||||
|
if (!str[1]) {
|
||||||
|
/* single letter; might be used for named fruit */
|
||||||
|
Strcpy(outbuf, index("aefhilmnosx", c0) ? "an " : "a ");
|
||||||
|
} else if (!strncmpi(str, "the ", 4) || !strcmpi(str, "molten lava")
|
||||||
|
|| !strcmpi(str, "iron bars") || !strcmpi(str, "ice")) {
|
||||||
|
; /* no article */
|
||||||
|
} else {
|
||||||
|
if ((index(vowels, c0) && strncmpi(str, "one-", 4)
|
||||||
|
&& strncmpi(str, "eucalyptus", 10) && strncmpi(str, "unicorn", 7)
|
||||||
|
&& strncmpi(str, "uranium", 7) && strncmpi(str, "useful", 6))
|
||||||
|
|| (index("x", c0) && !index(vowels, lowc(str[1]))))
|
||||||
|
Strcpy(outbuf, "an ");
|
||||||
|
else
|
||||||
|
Strcpy(outbuf, "a ");
|
||||||
|
}
|
||||||
|
return outbuf;
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
an(str)
|
an(str)
|
||||||
register const char *str;
|
const char *str;
|
||||||
{
|
{
|
||||||
char *buf = nextobuf();
|
char *buf = nextobuf();
|
||||||
|
|
||||||
buf[0] = '\0';
|
if (!str || !*str) {
|
||||||
|
impossible("Alphabet soup: 'an(%s)'.", str ? "\"\"" : "<null>");
|
||||||
if (strncmpi(str, "the ", 4) && strcmp(str, "molten lava")
|
return strcpy(buf, "an []");
|
||||||
&& strcmp(str, "iron bars") && strcmp(str, "ice")) {
|
|
||||||
if (index(vowels, *str) && strncmp(str, "one-", 4)
|
|
||||||
&& strncmp(str, "useful", 6) && strncmp(str, "unicorn", 7)
|
|
||||||
&& strncmp(str, "uranium", 7) && strncmp(str, "eucalyptus", 10))
|
|
||||||
Strcpy(buf, "an ");
|
|
||||||
else
|
|
||||||
Strcpy(buf, "a ");
|
|
||||||
}
|
}
|
||||||
|
just_an(buf, str);
|
||||||
Strcat(buf, str);
|
return strcat(buf, str);
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@@ -1633,6 +1654,10 @@ const char *str;
|
|||||||
char *buf = nextobuf();
|
char *buf = nextobuf();
|
||||||
boolean insert_the = FALSE;
|
boolean insert_the = FALSE;
|
||||||
|
|
||||||
|
if (!str || !*str) {
|
||||||
|
impossible("Alphabet soup: 'the(%s)'.", str ? "\"\"" : "<null>");
|
||||||
|
return strcpy(buf, "the []");
|
||||||
|
}
|
||||||
if (!strncmpi(str, "the ", 4)) {
|
if (!strncmpi(str, "the ", 4)) {
|
||||||
buf[0] = lowc(*str);
|
buf[0] = lowc(*str);
|
||||||
Strcpy(&buf[1], str + 1);
|
Strcpy(&buf[1], str + 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user