]> granicus.if.org Git - nethack/commitdiff
partial fix for S_unexplored
authorPatR <rankin@nethack.org>
Wed, 1 Apr 2020 22:49:28 +0000 (15:49 -0700)
committerPatR <rankin@nethack.org>
Wed, 1 Apr 2020 22:49:28 +0000 (15:49 -0700)
I've been sitting on this for a while but have decided that I'm not
likely to make any further progress.

SYMBOLS=S_stone:8,S_unexplored:9
on tty reveals that S_stone works as intended but S_unexplored does
not.  Unexplored was being drawn as spaces, and detected or sensed
monsters moving around unexplored areas left a trail of S_unexplored
characters behind them.  ^R reverted those to spaces.

This is only a partial fix that works when the map is initially drawn
or fully redrawn.  But after tty erases parts of lines (when deleting
a menu that overlaid the map or when clearing a message line that
wrapped onto the top line of the map), unexplored locations show up
as space rather than as S_unexplored.

src/display.c

index 30711647b0b7d46bf7844237c2978ac99c732585..b9abb33e2f6a9eca62ac5f2ec4dc688550c7167f 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 display.c       $NHDT-Date: 1583195581 2020/03/03 00:33:01 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.127 $ */
+/* NetHack 3.6 display.c       $NHDT-Date: 1585781359 2020/04/01 22:49:19 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.128 $ */
 /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
 /* and Dave Cohrs, 1990.                                          */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1501,7 +1501,7 @@ void
 newsym_force(x, y)
 register int x, y;
 {
-    newsym(x,y);
+    newsym(x, y);
     g.gbuf[y][x].gnew = 1;
     if (g.gbuf_start[y] > x)
         g.gbuf_start[y] = x;
@@ -1642,8 +1642,8 @@ int start, stop, y;
 void
 cls()
 {
-    int y;
     static boolean in_cls = 0;
+    int y, x, force_unexplored;
 
     if (in_cls)
         return;
@@ -1653,9 +1653,14 @@ cls()
     clear_nhwindow(WIN_MAP);              /* clear physical screen */
 
     clear_glyph_buffer(); /* this is sort of an extra effort, but OK */
+    force_unexplored = (g.showsyms[SYM_UNEXPLORED + SYM_OFF_X] != ' ');
     for (y = 0; y < ROWNO; y++) {
-        g.gbuf_start[y] = 0;
+        g.gbuf_start[y] = 1;
         g.gbuf_stop[y] = COLNO - 1;
+        if (force_unexplored) {
+            for (x = 1; x < COLNO; x++)
+                g.gbuf[y][x].gnew = 1;
+        }
     }
     in_cls = FALSE;
 }