autodescribe vs detection

Temporary map views for detection or #terrain allow moving the cursor
around to get the brief location description provided by getpos's
autodescribe feature and were doing so by forcing the 'autodescribe'
option to True, then leaving it that way.  Save the option value prior
to such operations and restore it after instead of leaving it changed.
This commit is contained in:
PatR
2017-04-08 19:39:43 -07:00
parent e1fbfcc8b5
commit 5cb4168c58
2 changed files with 6 additions and 2 deletions

View File

@@ -404,6 +404,8 @@ artifact creation violated illiterate conduct when artifact name was assigned,
behavior intended only for creating Sting or Orcrist via naming
tty: revert to pline() for issuing prompts (override MSGTYPE=hide differently)
previous tty-revert fix had the override test backwards, breaking MSGTYPE
save 'autodescribe' option value prior to detection or #terrain display and
restore it after rather than leave it forced on
Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 detect.c $NHDT-Date: 1463191981 2016/05/14 02:13:01 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.70 $ */
/* NetHack 3.6 detect.c $NHDT-Date: 1491705573 2017/04/09 02:39:33 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.76 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -59,13 +59,15 @@ int ter_typ;
const char *ter_explain;
{
coord dummy_pos; /* don't care whether player actually picks a spot */
boolean save_autodescribe;
dummy_pos.x = u.ux, dummy_pos.y = u.uy; /* starting spot for getpos() */
save_autodescribe = iflags.autodescribe;
iflags.autodescribe = TRUE;
iflags.terrainmode = ter_typ;
getpos(&dummy_pos, FALSE, ter_explain);
iflags.terrainmode = 0;
/* leave iflags.autodescribe 'on' even if previously 'off' */
iflags.autodescribe = save_autodescribe;
}
/* extracted from monster_detection() so can be shared by do_vicinity_map() */