thawing ice followup
Modifying an() [actually just_an()] to treat "<thickness> ice" and "frozen <hallucinatory liquid>" as special cases which shouldn't be prefixed with "a" or "an" affected using something like "shaved ice" or "frozen yogurt" as named fruit. |a) shaved ice |b) frozen yogurt (weapon in hand) now have article "a" preceding them: |a) a shaved ice |b) a frozen yogurt (weapon in hand) However, the existing cases |c) iron bars |d) an iron bars (weapon in hand) still get item 'c' wrong. 'd' is slightly odd but that's because the fruit name is ambiguous as to whether it's singular or plural.
This commit is contained in:
+8
-1
@@ -6,6 +6,13 @@
|
|||||||
#ifndef CONFIG_H /* make sure the compiler does not see the typedefs twice */
|
#ifndef CONFIG_H /* make sure the compiler does not see the typedefs twice */
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#define EXTRA_SANITY_CHECKS
|
||||||
|
#define MONITOR_HEAP
|
||||||
|
#define DUMPLOG
|
||||||
|
#define SCORE_ON_BOTL
|
||||||
|
#define EDIT_GETLIN
|
||||||
|
#define LIVELOG
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Section 1: Operating and window systems selection.
|
* Section 1: Operating and window systems selection.
|
||||||
* Select the version of the OS you are using.
|
* Select the version of the OS you are using.
|
||||||
@@ -582,7 +589,7 @@ typedef unsigned char uchar;
|
|||||||
|
|
||||||
/* An experimental minimalist inventory list capability under tty if you have
|
/* An experimental minimalist inventory list capability under tty if you have
|
||||||
* at least 28 additional rows beneath the status window on your terminal */
|
* at least 28 additional rows beneath the status window on your terminal */
|
||||||
/* #define TTY_PERM_INVENT */
|
#define TTY_PERM_INVENT /**/
|
||||||
|
|
||||||
/* NetHack will execute an external program whenever a new message-window
|
/* NetHack will execute an external program whenever a new message-window
|
||||||
* message is shown. The program to execute is given in environment variable
|
* message is shown. The program to execute is given in environment variable
|
||||||
|
|||||||
+20
-2
@@ -4359,8 +4359,26 @@ look_here(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dfeature && !skip_dfeature)
|
if (dfeature && !skip_dfeature) {
|
||||||
Sprintf(fbuf, "There is %s here.", an(dfeature));
|
const char *p;
|
||||||
|
int article = 1; /* 0 => none, 1 => a/an, 2 => the (not used here) */
|
||||||
|
|
||||||
|
/* "molten lava", "iron bars", and plain "ice" are handled as special
|
||||||
|
cases in an() but probably shouldn't be; don't rely on that */
|
||||||
|
if (!strcmp(dfeature, "molten lava")
|
||||||
|
|| !strcmp(dfeature, "iron bars")
|
||||||
|
|| !strcmp(dfeature, "ice")
|
||||||
|
|| !strncmp(dfeature, "frozen ", 7) /* ice while hallucinating */
|
||||||
|
/* thawing ice ("solid ice", "thin ice", &c) */
|
||||||
|
|| ((p = strchr(dfeature, ' ')) != 0 && !strcmpi(p, " ice")))
|
||||||
|
article = 0;
|
||||||
|
if (article == 1)
|
||||||
|
dfeature = an(dfeature);
|
||||||
|
|
||||||
|
/* hardcoded "is" worked here because "iron bars" is actually
|
||||||
|
"set of iron bars"; use vtense() instead of relying on that */
|
||||||
|
Sprintf(fbuf, "There %s %s here.", vtense(dfeature, "are"), dfeature);
|
||||||
|
}
|
||||||
|
|
||||||
if (!otmp || is_lava(u.ux, u.uy)
|
if (!otmp || is_lava(u.ux, u.uy)
|
||||||
|| (is_pool(u.ux, u.uy) && !Underwater)) {
|
|| (is_pool(u.ux, u.uy) && !Underwater)) {
|
||||||
|
|||||||
+9
-7
@@ -1858,18 +1858,20 @@ singular(struct obj* otmp, char* (*func)(OBJ_P))
|
|||||||
char *
|
char *
|
||||||
just_an(char *outbuf, const char *str)
|
just_an(char *outbuf, const char *str)
|
||||||
{
|
{
|
||||||
char c0, *p;
|
char c0;
|
||||||
|
|
||||||
*outbuf = '\0';
|
*outbuf = '\0';
|
||||||
c0 = lowc(*str);
|
c0 = lowc(*str);
|
||||||
if (!str[1] || str[1] == ' ') {
|
if (!str[1] || str[1] == ' ') {
|
||||||
/* single letter; might be used for named fruit or a musical note */
|
/* single letter; might be used for named fruit or a musical note */
|
||||||
Strcpy(outbuf, strchr("aefhilmnosx", c0) ? "an " : "a ");
|
Strcpy(outbuf, strchr("aefhilmnosx", c0) ? "an " : "a ");
|
||||||
} else if (!strncmpi(str, "the ", 4) || !strcmpi(str, "molten lava")
|
} else if (!strncmpi(str, "the ", 4)
|
||||||
|| !strcmpi(str, "iron bars") || !strcmpi(str, "ice")
|
/* these probably shouldn't be handled here because doing so
|
||||||
|| !strncmpi(str, "frozen ", 7) /* ice while hallucinating */
|
impacts inventory when using them for named fruit */
|
||||||
/* thawing ice ("solid ice", "thin ice", &c) */
|
|| !strcmpi(str, "molten lava")
|
||||||
|| ((p = strchr(str, ' ')) != 0 && !strcmpi(p, " ice"))) {
|
|| !strcmpi(str, "iron bars")
|
||||||
|
|| !strcmpi(str, "ice")
|
||||||
|
) {
|
||||||
; /* no article */
|
; /* no article */
|
||||||
} else {
|
} else {
|
||||||
/* normal case is "an <vowel>" or "a <consonant>" */
|
/* normal case is "an <vowel>" or "a <consonant>" */
|
||||||
@@ -2265,7 +2267,7 @@ static const char *const special_subjs[] = {
|
|||||||
|
|
||||||
/* return form of the verb (input plural) for present tense 3rd person subj */
|
/* return form of the verb (input plural) for present tense 3rd person subj */
|
||||||
char *
|
char *
|
||||||
vtense(const char* subj, const char* verb)
|
vtense(const char *subj, const char *verb)
|
||||||
{
|
{
|
||||||
char *buf = nextobuf(), *bspot;
|
char *buf = nextobuf(), *bspot;
|
||||||
int len, ltmp;
|
int len, ltmp;
|
||||||
|
|||||||
+14
-7
@@ -1062,7 +1062,7 @@ add_cmap_descr(
|
|||||||
const char **firstmatch, /* output: pointer to 1st matching description */
|
const char **firstmatch, /* output: pointer to 1st matching description */
|
||||||
char *out_str) /* input/output: current description gets appended */
|
char *out_str) /* input/output: current description gets appended */
|
||||||
{
|
{
|
||||||
char *mbuf = NULL;
|
char *mbuf = NULL, *p;
|
||||||
int absidx = abs(idx);
|
int absidx = abs(idx);
|
||||||
|
|
||||||
if (glyph == NO_GLYPH) {
|
if (glyph == NO_GLYPH) {
|
||||||
@@ -1111,11 +1111,17 @@ add_cmap_descr(
|
|||||||
Strcpy(mbuf, "lava");
|
Strcpy(mbuf, "lava");
|
||||||
x_str = mbuf;
|
x_str = mbuf;
|
||||||
article = !(!strncmp(x_str, "water", 5)
|
article = !(!strncmp(x_str, "water", 5)
|
||||||
|
|| !strncmp(x_str, "ice", 3)
|
||||||
|| !strncmp(x_str, "lava", 4)
|
|| !strncmp(x_str, "lava", 4)
|
||||||
|| !strncmp(x_str, "swamp", 5)
|
|| !strncmp(x_str, "swamp", 5)
|
||||||
|| !strncmp(x_str, "molten", 6)
|
|| !strncmp(x_str, "molten", 6)
|
||||||
|| !strncmp(x_str, "shallow", 7)
|
|| !strncmp(x_str, "shallow", 7)
|
||||||
|| !strncmp(x_str, "limitless", 9));
|
|| !strncmp(x_str, "limitless", 9)
|
||||||
|
/* ice while hallucinating */
|
||||||
|
|| !strncmp(x_str, "frozen", 6)
|
||||||
|
/* thawing ice ("solid ice", "thin ice", &c) */
|
||||||
|
|| ((p = strchr(x_str, ' ')) != 0 && !strcmpi(p, " ice"))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
@@ -1124,9 +1130,9 @@ add_cmap_descr(
|
|||||||
Sprintf(out_str, "%sa trap", prefix);
|
Sprintf(out_str, "%sa trap", prefix);
|
||||||
*hit_trap = TRUE;
|
*hit_trap = TRUE;
|
||||||
} else {
|
} else {
|
||||||
Sprintf(out_str, "%s%s", prefix,
|
Sprintf(out_str, "%s%s", prefix, (article == 2) ? the(x_str)
|
||||||
article == 2 ? the(x_str)
|
: (article == 1) ? an(x_str)
|
||||||
: article == 1 ? an(x_str) : x_str);
|
: x_str);
|
||||||
}
|
}
|
||||||
*firstmatch = x_str;
|
*firstmatch = x_str;
|
||||||
found = 1;
|
found = 1;
|
||||||
@@ -1226,6 +1232,7 @@ do_screen_description(
|
|||||||
if (x_str == unreconnoitered)
|
if (x_str == unreconnoitered)
|
||||||
goto didlook;
|
goto didlook;
|
||||||
}
|
}
|
||||||
|
|
||||||
check_monsters:
|
check_monsters:
|
||||||
/* Check for monsters */
|
/* Check for monsters */
|
||||||
if (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0) {
|
if (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0) {
|
||||||
@@ -1282,8 +1289,8 @@ do_screen_description(
|
|||||||
if (sym == DEF_INVISIBLE) {
|
if (sym == DEF_INVISIBLE) {
|
||||||
/* for active clairvoyance, use alternate "unseen creature" */
|
/* for active clairvoyance, use alternate "unseen creature" */
|
||||||
boolean usealt = (EDetect_monsters & I_SPECIAL) != 0L;
|
boolean usealt = (EDetect_monsters & I_SPECIAL) != 0L;
|
||||||
const char *unseen_explain = usealt ? altinvisexplain
|
const char *unseen_explain = (usealt || Blind) ? altinvisexplain
|
||||||
: Blind ? altinvisexplain : invisexplain;
|
: invisexplain;
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
Sprintf(out_str, "%s%s", prefix, an(unseen_explain));
|
Sprintf(out_str, "%s%s", prefix, an(unseen_explain));
|
||||||
|
|||||||
+1
-1
@@ -365,7 +365,7 @@ describe_decor(void)
|
|||||||
} else if (dfeature) {
|
} else if (dfeature) {
|
||||||
if (waterhere)
|
if (waterhere)
|
||||||
dfeature = strcpy(fbuf, waterbody_name(u.ux, u.uy));
|
dfeature = strcpy(fbuf, waterbody_name(u.ux, u.uy));
|
||||||
if (strcmp(dfeature, "swamp"))
|
if (strcmp(dfeature, "swamp") && ltyp != ICE)
|
||||||
dfeature = an(dfeature);
|
dfeature = an(dfeature);
|
||||||
|
|
||||||
if (Verbose(2, describe_decor1)) {
|
if (Verbose(2, describe_decor1)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user