]> granicus.if.org Git - nethack/commitdiff
tty: S_unexplored
authorPatR <rankin@nethack.org>
Fri, 17 Apr 2020 08:06:37 +0000 (01:06 -0700)
committerPatR <rankin@nethack.org>
Fri, 17 Apr 2020 08:06:37 +0000 (01:06 -0700)
Screen erasure leaves the map set to spaces.  If S_unexplored is
something other than <space>, tty wasn't drawing with S_unexplored
after a menu or long message line got erased following temporary
overwrite of part of the map.

This seems to work but is not the correct way to do things.
clear_screen(), cl_eos(), and cl_end() should all be taught to
flag the map as needing to be refreshed after they erase part of it.
tty_clear_nhwindow(WIN_BASE) is also lacking since it erases the
message line, full map, and status lines but leaves their internal
windows with stale data about what is shown instead of marking them
blank.

doc/fixes37.0
src/display.c
src/mapglyph.c
win/tty/wintty.c

index dccbbf54447da1ea4ef435b24fd613ef78397fba..681fc31a3ec98848de7ad719128db910c0a3ec25 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.183 $ $NHDT-Date: 1587024026 2020/04/16 08:00:26 $
+$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.184 $ $NHDT-Date: 1587110793 2020/04/17 08:06:33 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -184,6 +184,8 @@ fix crash in water_damage_chain
 teleport feedback "you materialize at another location" was given too soon
 'mention_decore' was repeatedly reporting "you are back on bottom" when
        moving around underwater
+tty: redraw unexplored locations as S_unexplored rather than <space> after
+       map has been partially overwritten by popup menu or text display
 X11: was still initializing map to 'stone' instead of 'unexplored' after they
        became separate glyphs
 X11: for text map without color, add support for black&white ice; draw it in
index b9abb33e2f6a9eca62ac5f2ec4dc688550c7167f..d7763e4fc82880e4fb04907695db962f1d616ede 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 display.c       $NHDT-Date: 1585781359 2020/04/01 22:49:19 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.128 $ */
+/* NetHack 3.6 display.c       $NHDT-Date: 1587110793 2020/04/17 08:06:33 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.129 $ */
 /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
 /* and Dave Cohrs, 1990.                                          */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1625,18 +1625,24 @@ clear_glyph_buffer()
     reset_glyph_bbox();
 }
 
-/*
- * Assumes that the indicated positions are filled with GLYPH_UNEXPLORED glyphs.
- */
+/* used by tty after menu or text popup has temporarily overwritten the map */
 void
 row_refresh(start, stop, y)
 int start, stop, y;
 {
-    register int x;
+    register int x, glyph;
+    register boolean force;
+    int ch = ' ', color = NO_COLOR;
+    unsigned special = 0;
+
+    (void) mapglyph(GLYPH_UNEXPLORED, &ch, &color, &special, 0, 0, 0);
+    force = (ch != ' ' || color != NO_COLOR || (special & ~MG_UNEXPL) != 0);
 
-    for (x = start; x <= stop; x++)
-        if (g.gbuf[y][x].glyph != GLYPH_UNEXPLORED)
-            print_glyph(WIN_MAP, x, y, g.gbuf[y][x].glyph, get_bk_glyph(x, y));
+    for (x = start; x <= stop; x++) {
+        glyph = g.gbuf[y][x].glyph;
+        if (force || glyph != GLYPH_UNEXPLORED)
+            print_glyph(WIN_MAP, x, y, glyph, get_bk_glyph(x, y));
+    }
 }
 
 void
index 3a6af5a39a743e3bc6fb8022a074b08e4f9ac08f..91e827e17170b82b0a77f32431ff8f418f3f2f72 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 mapglyph.c      $NHDT-Date: 1580252137 2020/01/28 22:55:37 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.62 $ */
+/* NetHack 3.6 mapglyph.c      $NHDT-Date: 1587110793 2020/04/17 08:06:33 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.64 $ */
 /* Copyright (c) David Cohrs, 1991                                */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -327,8 +327,8 @@ unsigned mgflags;
     ch = g.showsyms[idx];
 #ifdef TEXTCOLOR
     /* Turn off color if no color defined, or rogue level w/o PC graphics. */
-    if (!has_color(color) ||
-            ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) && !has_rogue_color))
+    if (!has_color(color)
+        || ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) && !has_rogue_color))
 #endif
         color = NO_COLOR;
     *ochar = (int) ch;
index ba940c7c152a1a7d810b662c03f5110e61ea2a17..e750a002dfdcd67639ef897153b5121b4b37b4bf 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 wintty.c        $NHDT-Date: 1580252140 2020/01/28 22:55:40 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.248 $ */
+/* NetHack 3.6 wintty.c        $NHDT-Date: 1587110794 2020/04/17 08:06:34 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.256 $ */
 /* Copyright (c) David Cohrs, 1991                                */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1652,13 +1652,16 @@ winid window;
         g.context.botlx = 1;
         break;
     case NHW_MAP:
-        /* cheap -- clear the whole thing and tell nethack to redraw botl */
-        g.context.botlx = 1;
-        /*FALLTHRU*/
+        /* the full map isn't erased often so the benefit of clearing the
+           whole screen and then redrawing status would be minimal here */
+        docorner(1, ROWNO - 1); /* sets map cells to S_unexplored
+                                 * which might not be <space> */
+        break;
     case NHW_BASE:
         clear_screen();
-        /*for (i = 0; i < cw->maxrow; ++i)           */
-        /*    finalx[i][NOW] = finalx[i][BEFORE] = 0;*/
+        if (!g.program_state.gameover)
+            g.context.botlx = 1;
+        /* [this sould also reset state for MESSAGE, MAP, and STATUS] */
         break;
     case NHW_MENU:
     case NHW_TEXT: