fix #6870 - clairvoyance feedback

Forwarded to the contact form from a github "issue":  in some
circumtances clairvoyance lets you move the cursor around to examine
the revealed map, and when doing so starts with "for instructions
type '?'".  When extended clairvoyance periodically kicks in, as
opposed to explicitly casting the spell, there wasn't sufficient
context to figure out what it was prompting for (unless you actually
answer '?' to get instructions).  Depending upon the most recent
message, it could seem like quite a strange prompt.  Explicitly give
a clairvoyance-specific message prior to that.

Also, the getpos() help was including suggestions for targetting
monsters that aren't appropriate when it's being used for detection.

do_name.c has had quite a bit of formatting rot slip in since 3.6.0.
This fixes up the stuff I spotted by manual inspection.
This commit is contained in:
PatR
2018-02-21 22:44:15 -08:00
parent 964120266e
commit 094c7f5c1b
3 changed files with 51 additions and 40 deletions

View File

@@ -584,6 +584,9 @@ unix: fix for freeing MAIL introduced a one-byte buffer overrun which could
interfere with malloc/free operation
unix: fix for freeing MAIL also introduced a memory leak whenever new mail
is detected and MAIL comes from the environment
when clairvoyance lets you move the cursor to examine the map (if it occurs
when engulfed or underwater or when blessed clairvoyance finds a
monster), the "for instructions type '?'" prompt could be confusing
Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 detect.c $NHDT-Date: 1495346103 2017/05/21 05:55:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.77 $ */
/* NetHack 3.6 detect.c $NHDT-Date: 1519281847 2018/02/22 06:44:07 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.80 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1324,6 +1324,10 @@ struct obj *sobj; /* scroll--actually fake spellbook--object */
if (!level.flags.hero_memory || unconstrained || mdetected) {
flush_screen(1); /* flush temp screen */
/* the getpos() prompt from browse_map() is only shown when
flags.verbose is set, but make this unconditional so that
not-verbose users become aware of the prompting situation */
You("sense your surroundings.");
if (extended || glyph_is_monster(glyph_at(u.ux, u.uy)))
ter_typ |= TER_MON;
if (extended)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_name.c $NHDT-Date: 1496531112 2017/06/03 23:05:12 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.119 $ */
/* NetHack 3.6 do_name.c $NHDT-Date: 1519281849 2018/02/22 06:44:09 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.127 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -6,8 +6,7 @@
STATIC_DCL char *NDECL(nextmbuf);
STATIC_DCL void FDECL(getpos_help, (BOOLEAN_P, const char *));
STATIC_DCL int FDECL(CFDECLSPEC cmp_coord_distu, (const void *,
const void *));
STATIC_DCL int FDECL(CFDECLSPEC cmp_coord_distu, (const void *, const void *));
STATIC_DCL boolean FDECL(gather_locs_interesting, (int, int, int));
STATIC_DCL void FDECL(gather_locs, (coord **, int *, int));
STATIC_DCL int FDECL(gloc_filter_floodfill_matcharea, (int, int));
@@ -37,12 +36,13 @@ nextmbuf()
* parameter value 0 = initialize, 1 = highlight, 2 = done
*/
static void FDECL((*getpos_hilitefunc), (int)) = (void FDECL((*), (int))) 0;
static boolean FDECL((*getpos_getvalid), (int,int)) = (boolean FDECL((*), (int,int))) 0;
static boolean FDECL((*getpos_getvalid), (int, int)) =
(boolean FDECL((*), (int, int))) 0;
void
getpos_sethilite(gp_hilitef, gp_getvalidf)
void FDECL((*gp_hilitef), (int));
boolean FDECL((*gp_getvalidf), (int,int));
boolean FDECL((*gp_getvalidf), (int, int));
{
getpos_hilitefunc = gp_hilitef;
getpos_getvalid = gp_getvalidf;
@@ -138,16 +138,18 @@ const char *goal;
visctrl(Cmd.spkeys[NHKF_GETPOS_MOVESKIP]),
fastmovemode[!iflags.getloc_moveskip]);
putstr(tmpwin, 0, sbuf);
Sprintf(sbuf, "Use '%s' to toggle menu listing for possible targets.",
visctrl(Cmd.spkeys[NHKF_GETPOS_MENU]));
putstr(tmpwin, 0, sbuf);
Sprintf(sbuf,
"Use '%s' to change the mode of limiting possible targets.",
visctrl(Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]));
putstr(tmpwin, 0, sbuf);
if (!iflags.terrainmode || (iflags.terrainmode & TER_DETECT) == 0) {
Sprintf(sbuf, "Use '%s' to toggle menu listing for possible targets.",
visctrl(Cmd.spkeys[NHKF_GETPOS_MENU]));
putstr(tmpwin, 0, sbuf);
Sprintf(sbuf,
"Use '%s' to change the mode of limiting possible targets.",
visctrl(Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]));
putstr(tmpwin, 0, sbuf);
}
if (!iflags.terrainmode) {
char kbuf[BUFSZ];
if (getpos_getvalid) {
Sprintf(sbuf, "Use '%s' or '%s' to move to valid locations.",
visctrl(Cmd.spkeys[NHKF_GETPOS_VALID_NEXT]),
@@ -282,20 +284,21 @@ int x,y;
if (glyph == gloc_filter_floodfill_match_glyph)
return TRUE;
if (gloc_filter_classify_glyph(glyph) == gloc_filter_classify_glyph(gloc_filter_floodfill_match_glyph))
if (gloc_filter_classify_glyph(glyph)
== gloc_filter_classify_glyph(gloc_filter_floodfill_match_glyph))
return TRUE;
return FALSE;
}
void
gloc_filter_floodfill(x,y)
int x,y;
gloc_filter_floodfill(x, y)
int x, y;
{
gloc_filter_floodfill_match_glyph = back_to_glyph(x,y);
gloc_filter_floodfill_match_glyph = back_to_glyph(x, y);
set_selection_floodfillchk(gloc_filter_floodfill_matcharea);
selection_floodfill(gloc_filter_map, x,y, FALSE);
selection_floodfill(gloc_filter_map, x, y, FALSE);
}
void
@@ -330,23 +333,20 @@ gloc_filter_done()
}
}
STATIC_OVL boolean
gather_locs_interesting(x,y, gloc)
int x,y, gloc;
gather_locs_interesting(x, y, gloc)
int x, y, gloc;
{
/* TODO: if glyph is a pile glyph, convert to ordinary one
* in order to keep tail/boulder/rock check simple.
*/
int glyph = glyph_at(x, y);
if (iflags.getloc_filter == GFILTER_VIEW && !cansee(x,y))
if (iflags.getloc_filter == GFILTER_VIEW && !cansee(x, y))
return FALSE;
if (iflags.getloc_filter == GFILTER_AREA && !GLOC_SAME_AREA(x,y)
&& !GLOC_SAME_AREA(x-1,y)
&& !GLOC_SAME_AREA(x,y-1)
&& !GLOC_SAME_AREA(x+1,y)
&& !GLOC_SAME_AREA(x,y+1))
if (iflags.getloc_filter == GFILTER_AREA && !GLOC_SAME_AREA(x, y)
&& !GLOC_SAME_AREA(x - 1, y) && !GLOC_SAME_AREA(x, y - 1)
&& !GLOC_SAME_AREA(x + 1, y) && !GLOC_SAME_AREA(x, y + 1))
return FALSE;
switch (gloc) {
@@ -480,7 +480,8 @@ boolean fulldir;
if (dx) {
if (abs(dx) > 9999)
dx = sgn(dx) * 9999;
Sprintf(eos(buf), "%d%s", abs(dx), dirnames[2 + (dx > 0)][fulldir]);
Sprintf(eos(buf), "%d%s", abs(dx),
dirnames[2 + (dx > 0)][fulldir]);
}
}
return buf;
@@ -544,8 +545,9 @@ int cx, cy;
(void) coord_desc(cx, cy, tmpbuf, iflags.getpos_coords);
custompline(SUPPRESS_HISTORY,
"%s%s%s%s%s", firstmatch, *tmpbuf ? " " : "", tmpbuf,
(iflags.autodescribe && getpos_getvalid && !getpos_getvalid(cx,cy))
? " (illegal)" : "",
(iflags.autodescribe
&& getpos_getvalid && !getpos_getvalid(cx, cy))
? " (illegal)" : "",
(iflags.getloc_travelmode && !is_valid_travelpt(cx, cy))
? " (no travel path)" : "");
curs(WIN_MAP, cx, cy);
@@ -590,8 +592,10 @@ int gloc;
tmpcc.x = garr[i].x;
tmpcc.y = garr[i].y;
if (do_screen_description(tmpcc, TRUE, sym, tmpbuf, &firstmatch)) {
(void) coord_desc(garr[i].x, garr[i].y, tmpbuf, iflags.getpos_coords);
Sprintf(fullbuf, "%s%s%s", firstmatch, (*tmpbuf ? " " : ""), tmpbuf);
(void) coord_desc(garr[i].x, garr[i].y, tmpbuf,
iflags.getpos_coords);
Sprintf(fullbuf, "%s%s%s", firstmatch,
(*tmpbuf ? " " : ""), tmpbuf);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, fullbuf,
MENU_UNSELECTED);
}
@@ -738,8 +742,9 @@ const char *goal;
dy = ydir[i];
while (isok(cx + dx, cy + dy)
&& glyph == glyph_at(cx + dx, cy + dy)
&& isok(cx + dx+xdir[i], cy+dy+ydir[i])
&& glyph == glyph_at(cx + dx+xdir[i], cy + dy+ydir[i])) {
&& isok(cx + dx + xdir[i], cy + dy + ydir[i])
&& glyph == glyph_at(cx + dx + xdir[i],
cy + dy + ydir[i])) {
dx += xdir[i];
dy += ydir[i];
}
@@ -928,10 +933,9 @@ const char *goal;
if (!force)
Strcpy(note, "aborted");
else
Sprintf(note, "use '%c', '%c', '%c', '%c' or '%s'", /* hjkl */
Cmd.move_W, Cmd.move_S, Cmd.move_N,
Cmd.move_E,
else /* hjkl */
Sprintf(note, "use '%c', '%c', '%c', '%c' or '%s'",
Cmd.move_W, Cmd.move_S, Cmd.move_N, Cmd.move_E,
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK]));
pline("Unknown direction: '%s' (%s).", visctrl((char) c),
note);
@@ -966,7 +970,7 @@ const char *goal;
if (garr[i])
free((genericptr_t) garr[i]);
getpos_hilitefunc = (void FDECL((*), (int))) 0;
getpos_getvalid = (boolean FDECL((*), (int,int))) 0;
getpos_getvalid = (boolean FDECL((*), (int, int))) 0;
return result;
}