]> granicus.if.org Git - nethack/commitdiff
autodescribe vs detection
authorPatR <rankin@nethack.org>
Sun, 9 Apr 2017 02:39:43 +0000 (19:39 -0700)
committerPatR <rankin@nethack.org>
Sun, 9 Apr 2017 02:39:43 +0000 (19:39 -0700)
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.

doc/fixes36.1
src/detect.c

index 5ad9d072ac85eb9148f250b2dccb8e090ec1f271..ce42dc224784a029d95cd3ffa1fefde376b68ca1 100644 (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
index a46cf47f943dc1df4c064131dc9775cc86f8acbc..def22469e25695c97949007b68f080f1a97a0c1f 100644 (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() */