]> granicus.if.org Git - nethack/commitdiff
curses message management
authorPatR <rankin@nethack.org>
Sun, 26 Dec 2021 08:43:24 +0000 (00:43 -0800)
committerPatR <rankin@nethack.org>
Sun, 26 Dec 2021 08:43:24 +0000 (00:43 -0800)
Switch from 'moves' to 'hero_seq' for tracking whether consecutive
messages were issued on the same move and for whether current move
is still same one after played has responded to --More-- with ESC.

win/curses/cursmain.c
win/curses/cursmesg.c

index c784333551fa47c44d62e54caccebba4d55b0cc7..d9cfcbfc8b90983a87684da06e8afe6cba389c50 100644 (file)
@@ -17,8 +17,8 @@ char erase_char, kill_char;
 extern char erase_char, kill_char;
 #endif
 
-extern long curs_mesg_suppress_turn; /* from cursmesg.c */
-extern boolean curs_mesg_suppress_suppression; /* ditto */
+extern long curs_mesg_suppress_seq; /* from cursmesg.c */
+extern boolean curs_mesg_no_suppress; /* ditto */
 
 /* stubs for curses_procs{} */
 #ifdef POSITIONBAR
@@ -502,8 +502,8 @@ curses_putstr(winid wid, int attr, const char *text)
     /* this is comparable to tty's cw->flags &= ~WIN_STOP; if messages are
        being suppressed after >>ESC, override that and resume showing them */
     if ((mesgflags & ATR_URGENT) != 0) {
-         curs_mesg_suppress_turn = -1L;
-         curs_mesg_suppress_suppression = TRUE;
+         curs_mesg_suppress_seq = -1L;
+         curs_mesg_no_suppress = TRUE;
     }
 
     if (wid == WIN_MESSAGE && (mesgflags & ATR_NOHISTORY) != 0) {
@@ -516,7 +516,7 @@ curses_putstr(winid wid, int attr, const char *text)
     }
 
     /* urgent message handling is a one-shot operation; we're done */
-    curs_mesg_suppress_suppression = FALSE;
+    curs_mesg_no_suppress = FALSE;
 }
 
 /* Display the file named str.  Complain about missing files
index c63932ab4503a7c4723dafbb49767147ff34c41f..e213e45a5c8c04e8ad51adf0a8b4d2f12ec70f0c 100644 (file)
@@ -20,12 +20,12 @@ extern char erase_char, kill_char;
 /* player can type ESC at More>> prompt to avoid seeing more messages
    for the current move; but hero might get more than one move per turn,
    so the input routines need to be able to cancel this */
-long curs_mesg_suppress_turn = -1L;
+long curs_mesg_suppress_seq = -1L;
 /* if a message is marked urgent, existing suppression will be overridden
    so that messages resume being shown; this is used in case the urgent
    message triggers More>> for the previous message and the player responds
    with ESC; we need to avoid initiating suppression in that situation */
-boolean curs_mesg_suppress_suppression = FALSE;
+boolean curs_mesg_no_suppress = FALSE;
 
 /* Message window routines for curses interface */
 
@@ -77,7 +77,7 @@ curses_message_win_puts(const char *message, boolean recursed)
     }
 #endif
 
-    if (curs_mesg_suppress_turn == g.moves) {
+    if (curs_mesg_suppress_seq == g.hero_seq) {
         return; /* user has typed ESC to avoid seeing remaining messages. */
     }
 
@@ -117,8 +117,8 @@ curses_message_win_puts(const char *message, boolean recursed)
                  /* pause until key is hit - ESC suppresses further messages
                     this turn unless an urgent message is being delivered */
                 if (curses_more() == '\033'
-                    && !curs_mesg_suppress_suppression) {
-                    curs_mesg_suppress_turn = g.moves;
+                    && !curs_mesg_no_suppress) {
+                    curs_mesg_suppress_seq = g.hero_seq;
                     return;
                 }
                 /* turn_lines reset to 0 by more()->block()->got_input() */
@@ -172,7 +172,7 @@ void
 curses_got_input(void)
 {
     /* if messages are being suppressed, reenable them */
-    curs_mesg_suppress_turn = -1L;
+    curs_mesg_suppress_seq = -1L;
 
     /* misleadingly named; represents number of lines delivered since
        player was sure to have had a chance to read them; if player
@@ -794,7 +794,7 @@ mesg_add_line(const char *mline)
             current_mesg->str = dupstr(mline);
         }
     }
-    current_mesg->turn = g.moves;
+    current_mesg->turn = g.hero_seq;
 
     if (num_messages == 0) {
         /* very first message; set up head */