]> granicus.if.org Git - nethack/commitdiff
ensure BL_FLUSH always sent when context.botlx is set
authornhmall <nhmall@nethack.org>
Sun, 2 Sep 2018 22:26:42 +0000 (18:26 -0400)
committernhmall <nhmall@nethack.org>
Sun, 2 Sep 2018 22:26:42 +0000 (18:26 -0400)
ensure BL_FLUSH always gets sent down to the window port whenever bot() is
called with context.botlx set so that status updates work as
expected after full screen clear after a level change

Fixes #107

doc/fixes36.2
src/botl.c

index 66171870bb1ae5da16633d6af7c3bb8ddd124cba..89c6129ace6307f29e214d2a4c9113faa47e6c8c 100644 (file)
@@ -107,6 +107,9 @@ wizard mode #wizidentify didn't disclose extra information for unID'd items if
 make transformation message of a deliberate apply of a figurine seem a bit 
        less definite when blind and place unseen monster marker at the spot
        you think it should be
+ensure BL_FLUSH always gets sent down to the window port whenever bot() is
+       called with context.botlx set so that status updates work as
+       expected after full screen clear after a level change
 
 
 Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
index a1ea624831a2ba400a588f33a9387ae9a334c57c..dc862ab0eefc2e643d2c640b7e83d46b342710b9 100644 (file)
@@ -770,8 +770,7 @@ evaluate_and_notify_windowport(valsetlist, idx, idx_p)
 int idx, idx_p;
 boolean *valsetlist;
 {
-    int i;
-    boolean updated = FALSE;
+    int i, updated = 0, notpresent = 0;
 
     /*
      *  Now pass the changed values to window port.
@@ -781,24 +780,32 @@ boolean *valsetlist;
             || ((i == BL_EXP) && !flags.showexp)
             || ((i == BL_TIME) && !flags.time)
             || ((i == BL_HD) && !Upolyd)
-            || ((i == BL_XP || i == BL_EXP) && Upolyd))
+            || ((i == BL_XP || i == BL_EXP) && Upolyd)) {
+            notpresent++;
             continue;
+        }
         if (evaluate_and_notify_windowport_field(i, valsetlist, idx, idx_p))
-            updated = TRUE;
+            updated++;
     }
     /*
-     * It is possible to get here, with nothing having been pushed
-     * to the window port, when none of the info has changed. In that
-     * case, we need to force a call to status_update() when
-     * context.botlx is set. The tty port in particular has a problem
+     * Notes:
+     *  1. It is possible to get here, with nothing having been pushed
+     *     to the window port, when none of the info has changed.
+     *
+     *  2. Some window ports are also known to optimize by only drawing
+     *     fields that have changed since the previous update.
+     *
+     * In both of those situations, we need to force updates to
+     * all of the fields when context.botlx is set.
+     *
+     * The tty port in particular has a problem
      * if that isn't done, since it sets context.botlx when a menu or
-     * text display obliterates the status line.
+     * text display obliterates the status line. 
      *
-     * To work around it, we call status_update() with fictitious
+     * To trigger the full update we call status_update() with fictitious
      * index of BL_FLUSH (-1).
      */
-    if ((context.botlx && !updated)
-        || (windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
+    if (context.botlx || (windowprocs.wincap2 & WC2_FLUSH_STATUS) != 0L)
         status_update(BL_FLUSH, (genericptr_t) 0, 0, 0,
                       NO_COLOR, &cond_hilites[0]);