]> granicus.if.org Git - nethack/commitdiff
identifying via menu
authorPatR <rankin@nethack.org>
Tue, 10 Jan 2023 07:34:32 +0000 (23:34 -0800)
committerPatR <rankin@nethack.org>
Tue, 10 Jan 2023 07:34:32 +0000 (23:34 -0800)
From the newsgroup:  identifying by menu pops up multiple menus in
succession if the player picks fewer invent entries than are being
granted, but the second and subsequent ones could cover up the
message window and hide the feedback from prior ones.

If multiple popup menus are needed when identifying, issue --More--
before each menu after the first.  The code seemed to be trying to
do this already, but it should have used wait_synch() rather than
mark_synch(), or perhaps used display_nhwindow(WIN_MESSAGE, TRUE)
instead of either one of those.  For curses, both mark_synch() and
wait_synch() were no-ops.  Now they do something.  X11's behavior
wasn't right either; it seemed to be lagging one message behind
(something I had noticed recently and then forgotten about; I still
don't remember the context then so don't know whether this fixes
that earlier situation).

doc/fixes3-7-0.txt
include/wincurs.h
src/invent.c
win/X11/winX.c
win/curses/cursmain.c
win/curses/cursmesg.c
win/curses/cursmesg.h

index f8a3c53d0e3df8d868aefca992b021ff58ffd86d..1243d392e554e829d2b31dd1b18b8a1dcbfe4375 100644 (file)
@@ -1078,6 +1078,9 @@ sleeping or unconscious hero attacked by Medusa would meet her gaze
 if a trap killed both the hero's steed and the hero an impossible "dmonsfree:
        N+1 removed doesn't match N pending" warning could occur
 prevent paralyzed hero from helping nymph or succubus remove worn armor
+when identifying items via menu and more than one pass is needed (so when
+       identifying 3 items and player only picks 1, for instance), issue
+       --More-- because the next menu might cover up the ID message(s)
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
@@ -1545,6 +1548,7 @@ curses: if a menu of objects contains at least one iron ball, and player is
        group accelerator rather than the start of a count
 curses: obey timed_delay option
 curses: support tty-style extended role/race/&c selection at start of new game
+curses: implement mark_synch() and wait_synch()
 macOS: Xcode project was failing to build if the path to the NetHack source
        tree contained a space; the issue was within some shell script code
        contained within the project
index 5e057fae9188cec9199892d5a9ed0f8842451bbc..03bc4d527c5ddca1cca20d1da192b6248a5e4b16 100644 (file)
@@ -221,6 +221,7 @@ extern void curses_cleanup(void);
 
 extern void curses_message_win_puts(const char *message, boolean recursed);
 extern void curses_got_input(void);
+extern int curses_got_output(void);
 extern int curses_block(boolean require_tab); /* for MSGTYPE=STOP */
 extern int curses_more(void);
 extern void curses_clear_unhighlight_message_window(void);
index 39ea9a795bf1f5b8feea06b2db875a862a4f453b..a7e743b5c6b128a1bc7a63735fac8c39bf107a74 100644 (file)
@@ -2351,7 +2351,8 @@ menu_identify(int id_limit)
             for (i = 0; i < n; i++, id_limit--)
                 (void) identify(pick_list[i].item.a_obj);
             free((genericptr_t) pick_list);
-            mark_synch(); /* Before we loop to pop open another menu */
+            if (id_limit)
+                wait_synch(); /* Before we loop to pop open another menu */
             first = 0;
         } else if (n == -2) { /* player used ESC to quit menu */
             break;
@@ -2381,8 +2382,9 @@ count_unidentified(struct obj *objchn)
 
 /* dialog with user to identify a given number of items; 0 means all */
 void
-identify_pack(int id_limit,
-              boolean learning_id) /* T: just read unknown identify scroll */
+identify_pack(
+    int id_limit,
+    boolean learning_id) /* T: just read unknown identify scroll */
 {
     struct obj *obj;
     int n, unid_cnt = count_unidentified(gi.invent);
@@ -2396,7 +2398,7 @@ identify_pack(int id_limit,
         for (obj = gi.invent; obj; obj = obj->nobj) {
             if (not_fully_identified(obj)) {
                 (void) identify(obj);
-                if (unid_cnt == 1)
+                if (--unid_cnt < 1)
                     break;
             }
         }
index 337d0c46ce64f02461bf2a49f13c66ec05ab1665..690b34b8e4f18cfb1fb450efd8bd148391987f66 100644 (file)
@@ -1334,8 +1334,10 @@ X11_mark_synch(void)
 void
 X11_wait_synch(void)
 {
-    if (x_inited)
+    if (x_inited) {
+        X11_mark_synch();
         XFlush(XtDisplay(toplevel));
+    }
 }
 
 /* Both resume_ and suspend_ are called from ioctl.c and unixunix.c. */
index c20aad69aeb2e9e089c731cf863e78d9d25dc391..2d29dacd6c4116f50b41ab60700aeb47a9eb860d 100644 (file)
@@ -150,8 +150,9 @@ init_nhwindows(int* argcp, char** argv)
                 ** windows?  Or at least all but WIN_INFO?      -dean
 */
 void
-curses_init_nhwindows(int *argcp UNUSED,
-                      char **argv UNUSED)
+curses_init_nhwindows(
+    int *argcp UNUSED,
+    char **argv UNUSED)
 {
 #ifdef PDCURSES
     char window_title[BUFSZ];
@@ -745,12 +746,12 @@ curses_ctrl_nhwindow(
 
 /*
 mark_synch()    -- Don't go beyond this point in I/O on any channel until
-                   all channels are caught up to here.  Can be an empty call
-                   for the moment
+                   all channels are caught up to here.
 */
 void
 curses_mark_synch(void)
 {
+    curses_refresh_nethack_windows();
 }
 
 /*
@@ -762,6 +763,9 @@ wait_synch()    -- Wait until all pending output is complete (*flush*() for
 void
 curses_wait_synch(void)
 {
+    if (curses_got_output())
+        (void) curses_more();
+    curses_mark_synch();
     /* [do we need 'if (counting) curses_count_window((char *)0);' here?] */
 }
 
index 6da089c6b04729d1aa372dcdf84c0f610f97718c..d1e82af49222c14a94e9746c71dbd8d41b0b97a0 100644 (file)
@@ -182,9 +182,16 @@ curses_got_input(void)
 }
 
 int
-curses_block(boolean noscroll) /* noscroll - blocking because of msgtype
-                                * = stop/alert else blocking because
-                                * window is full, so need to scroll after */
+curses_got_output(void)
+{
+    return turn_lines;
+}
+
+int
+curses_block(
+    boolean noscroll) /* noscroll - blocking because of MSGTYPE=STOP/ALERT
+                       * else blocking because window is full, so need to
+                       * scroll after */
 {
     static const char resp[] = " \r\n\033"; /* space, enter, esc */
     static int prev_x = -1, prev_y = -1, blink = 0;
index 88c62d97b11decbbcb456fb15fe6d34afdfb6ef2..6653532db593d6b4e616d14f85ad02c1b9f06c30 100644 (file)
@@ -11,6 +11,7 @@
 
 void curses_message_win_puts(const char *message, boolean recursed);
 void curses_got_input(void);
+int curses_got_output(void);
 int curses_block(boolean require_tab);
 int curses_more(void);
 void curses_clear_unhighlight_message_window(void);