lookat issues for unknown/solid rock/dark room

Fix two things with the ';' and '/' commands, both for looking at blank
space.  The list of possibilies included "a dark part of a room or the
dark part of a room" even though the code involved goes out of its way
to avoid redundant clauses.  S_stone let dark part be prefixed by 'a',
S_room and S_darkroom forced it to be 'the' which is better phrasing
but outsmarted the redundancy check.  Make S_stone's use of "dark part
of a room" force 'the' too.

That's trivial; this is more complicated:  the new maze variations
exposed/aggravated an issue that's been there all along.  In a non-
WALLIFIED maze, doing look-at on the solid stone in-place-of-wall
next to you reported "dark part of a room" which is clearly wrong when
you can tell it's not a room.  (The same thing happens in any ordinary
corridor, but players rarely try to identify blank space next to them
it that circumstance so it hasn't mattered very much.)  This change
results in look-at listing "unexplored" and "stone" as additional
possibilities when looking at blank spots.  Final description will be
"unexplored" instead of dark room if you haven't seen the spot, "stone"
if you have and that's what it is, or "dark part of a room" otherwise.
This commit is contained in:
PatR
2015-06-05 20:19:18 -07:00
parent c890269947
commit 7218f2bfbd
+48 -26
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 pager.c $NHDT-Date: 1432890463 2015/05/29 09:07:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.74 $ */ /* NetHack 3.6 pager.c $NHDT-Date: 1433560744 2015/06/06 03:19:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.76 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -320,6 +320,15 @@ char *buf, *monbuf;
Strcpy(buf, Strcpy(buf,
Is_airlevel(&u.uz) ? "cloudy area" : "fog/vapor cloud"); Is_airlevel(&u.uz) ? "cloudy area" : "fog/vapor cloud");
break; break;
case S_stone:
if (!levl[x][y].seenv) {
Strcpy(buf, "unexplored");
break;
} else if (levl[x][y].typ == STONE || levl[x][y].typ == SCORR) {
Strcpy(buf, "stone");
break;
}
/*else FALLTHRU*/
default: default:
Strcpy(buf, defsyms[glyph_to_cmap(glyph)].explanation); Strcpy(buf, defsyms[glyph_to_cmap(glyph)].explanation);
break; break;
@@ -514,11 +523,11 @@ char *out_str;
const char **firstmatch; const char **firstmatch;
{ {
boolean need_to_look = FALSE; boolean need_to_look = FALSE;
int glyph; int glyph = NO_GLYPH;
static char look_buf[BUFSZ]; static char look_buf[BUFSZ];
char prefix[BUFSZ]; char prefix[BUFSZ];
int found = 0; /* count of matching syms found */ int found = 0; /* count of matching syms found */
int i; int i, alt_i;
int skipped_venom = 0; int skipped_venom = 0;
boolean hit_trap; boolean hit_trap;
const char *x_str; const char *x_str;
@@ -549,7 +558,8 @@ const char **firstmatch;
* and looking at something other than our own symbol, then just say * and looking at something other than our own symbol, then just say
* "the interior of a monster". * "the interior of a monster".
*/ */
if (u.uswallow && (looked) && (is_swallow_sym(sym) || (int)showsyms[S_stone] == sym)) { if (u.uswallow && looked
&& (is_swallow_sym(sym) || (int)showsyms[S_stone] == sym)) {
if (!found) { if (!found) {
Sprintf(out_str, "%s%s", prefix, mon_interior); Sprintf(out_str, "%s%s", prefix, mon_interior);
*firstmatch = mon_interior; *firstmatch = mon_interior;
@@ -562,7 +572,7 @@ const char **firstmatch;
/* Check for monsters */ /* Check for monsters */
for (i = 0; i < MAXMCLASSES; i++) { for (i = 0; i < MAXMCLASSES; i++) {
if (sym == ((looked) ? showsyms[i + SYM_OFF_M] : def_monsyms[i].sym) if (sym == (looked ? showsyms[i + SYM_OFF_M] : def_monsyms[i].sym)
&& def_monsyms[i].explain) { && def_monsyms[i].explain) {
need_to_look = TRUE; need_to_look = TRUE;
if (!found) { if (!found) {
@@ -577,18 +587,17 @@ const char **firstmatch;
/* handle '@' as a special case if it refers to you and you're /* handle '@' as a special case if it refers to you and you're
playing a character which isn't normally displayed by that playing a character which isn't normally displayed by that
symbol; firstmatch is assumed to already be set for '@' */ symbol; firstmatch is assumed to already be set for '@' */
if (((looked) ? (sym == showsyms[S_HUMAN + SYM_OFF_M] && cc.x == u.ux if ((looked ? (sym == showsyms[S_HUMAN + SYM_OFF_M]
&& cc.y == u.uy) && cc.x == u.ux && cc.y == u.uy)
: (sym == def_monsyms[S_HUMAN].sym && !flags.showrace)) : (sym == def_monsyms[S_HUMAN].sym && !flags.showrace))
&& !(Race_if(PM_HUMAN) || Race_if(PM_ELF)) && !Upolyd) && !(Race_if(PM_HUMAN) || Race_if(PM_ELF)) && !Upolyd)
found += append_str(out_str, "you"); /* tack on "or you" */ found += append_str(out_str, "you"); /* tack on "or you" */
/* Now check for objects */ /* Now check for objects */
for (i = 1; i < MAXOCLASSES; i++) { for (i = 1; i < MAXOCLASSES; i++) {
if (sym if (sym == (looked ? showsyms[i + SYM_OFF_O] : def_oc_syms[i].sym)) {
== ((looked) ? showsyms[i + SYM_OFF_O] : def_oc_syms[i].sym)) {
need_to_look = TRUE; need_to_look = TRUE;
if ((looked) && i == VENOM_CLASS) { if (looked && i == VENOM_CLASS) {
skipped_venom++; skipped_venom++;
continue; continue;
} }
@@ -616,15 +625,28 @@ const char **firstmatch;
#define is_cmap_drawbridge(i) ((i) >= S_vodbridge && (i) <= S_hcdbridge) #define is_cmap_drawbridge(i) ((i) >= S_vodbridge && (i) <= S_hcdbridge)
/* Now check for graphics symbols */ /* Now check for graphics symbols */
for (hit_trap = FALSE, i = 0; i < MAXPCHARS; i++) { alt_i = (sym == (looked ? showsyms[0] : defsyms[0].sym)) ? 0 : 2+1;
x_str = defsyms[i].explanation; for (hit_trap = FALSE, i = alt_i = 0; i < MAXPCHARS; i++) {
if (sym == ((looked) ? showsyms[i] : defsyms[i].sym) && *x_str) { /* when sym is the default background character, we process
/* avoid "an air", "a water", "a floor of a room", "a dark part of i == 0 three times: unexplored, stone, dark part of a room */
* a room" */ if (alt_i < 2) {
int article = x_str = !alt_i++ ? "unexplored" : "stone";
((i == S_room) || (i == S_darkroom)) ? 2 : /* 2=>"the" */ i = 0; /* for second iteration, undo loop increment */
!(strcmp(x_str, "air") == 0 || /* 1=>"an" */ /* alt_i is now 1 or 2 */
strcmp(x_str, "water") == 0); /* 0=>(none)*/ } else {
if (alt_i++ == 2)
i = 0; /* undo loop increment */
x_str = defsyms[i].explanation;
/* alt_i is now 3 or more and no longer of interest */
}
if (sym == (looked ? showsyms[i] : defsyms[i].sym) && *x_str) {
/* avoid "an unexplored", "an stone", "an air", "a water",
"a floor of a room", "a dark part of a room";
article==2 => "the", 1 => "an", 0 => (none) */
int article = strstri(x_str, " of a room") ? 2
: !(alt_i <= 2
|| strcmp(x_str, "air") == 0
|| strcmp(x_str, "water") == 0);
if (!found) { if (!found) {
if (is_cmap_trap(i)) { if (is_cmap_trap(i)) {
@@ -633,15 +655,15 @@ const char **firstmatch;
} 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) : x_str); : article == 1 ? an(x_str) : x_str);
} }
*firstmatch = x_str; *firstmatch = x_str;
found++; found++;
} else if (!u.uswallow && !(hit_trap && is_cmap_trap(i)) } else if (!u.uswallow && !(hit_trap && is_cmap_trap(i))
&& !(found >= 3 && is_cmap_drawbridge(i))) { && !(found >= 3 && is_cmap_drawbridge(i))) {
found += append_str( found += append_str(out_str,
out_str, article == 2 ? the(x_str) article == 2 ? the(x_str)
: article == 1 ? an(x_str) : x_str); : article == 1 ? an(x_str) : x_str);
if (is_cmap_trap(i)) if (is_cmap_trap(i))
hit_trap = TRUE; hit_trap = TRUE;
} }
@@ -654,7 +676,7 @@ const char **firstmatch;
/* Now check for warning symbols */ /* Now check for warning symbols */
for (i = 1; i < WARNCOUNT; i++) { for (i = 1; i < WARNCOUNT; i++) {
x_str = def_warnsyms[i].explanation; x_str = def_warnsyms[i].explanation;
if (sym == ((looked) ? warnsyms[i] : def_warnsyms[i].sym)) { if (sym == (looked ? warnsyms[i] : def_warnsyms[i].sym)) {
if (!found) { if (!found) {
Sprintf(out_str, "%s%s", prefix, def_warnsyms[i].explanation); Sprintf(out_str, "%s%s", prefix, def_warnsyms[i].explanation);
*firstmatch = def_warnsyms[i].explanation; *firstmatch = def_warnsyms[i].explanation;
@@ -664,7 +686,7 @@ const char **firstmatch;
} }
/* Kludge: warning trumps boulders on the display. /* Kludge: warning trumps boulders on the display.
Reveal the boulder too or player can get confused */ Reveal the boulder too or player can get confused */
if ((looked) && sobj_at(BOULDER, cc.x, cc.y)) if (looked && sobj_at(BOULDER, cc.x, cc.y))
Strcat(out_str, " co-located with a boulder"); Strcat(out_str, " co-located with a boulder");
break; /* out of for loop*/ break; /* out of for loop*/
} }