]> granicus.if.org Git - nethack/commitdiff
curses message history vs dumplog message history
authorPatR <rankin@nethack.org>
Sun, 30 Jun 2019 18:50:08 +0000 (11:50 -0700)
committerPatR <rankin@nethack.org>
Sun, 30 Jun 2019 18:50:08 +0000 (11:50 -0700)
When I implemented getmsghistory()/putmsghistory() for curses I was
assuming that DUMPLOG would only be used with tty, but it is interface
neutral and can be used with curses (or others).  So curses message
history needs to behave like tty message history and be sure to pass
along messages that bypass pline() and the normal message window.
(Mainly one-line summaries of long quest messages, but also old
messages fetched from a save file and available to be re-saved without
having been shown if new session doesn't generate enough new messages
to flush them.)

doc/fixes36.3
win/curses/cursmesg.c

index d03090095b6d79ebb9a4046625d79f94753a2b2e..261215b97e70839fff1cfa9ace49f0f2b010b178 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.79 $ $NHDT-Date: 1561917056 2019/06/30 17:50:56 $
+$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.80 $ $NHDT-Date: 1561920590 2019/06/30 18:49:50 $
 
 This fixes36.3 file is here to capture information about updates in the 3.6.x
 lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -177,6 +177,8 @@ curses+'perm_invent': don't highlight inventory letters since nothing is
        selectable from the menu comprising the persistent inventory window
 curses+'popup_dialog': show the text cursor at the end of prompts for single
        character input
+curses+DUMPLOG: pass along old messages from save file and quest message
+       summaries to dumplog message history
 curses+EDIT_GETLIN: when a prompt's answer was preloaded, using ESC to discard
        it deleted it from the answer buffer but didn't erase it from screen
 curses+EDIT_GETLIN: the preceding fix handled an answer which spanned more
index ba387f344b7cfafb0e429d800b5fddd94f2fdc94..7c83ac423fa72aa3d03ed57cd6ec67fa4ac38526 100644 (file)
@@ -887,6 +887,9 @@ boolean restoring_msghist;
     static boolean initd = FALSE;
     static int stash_count;
     static nhprev_mesg *stash_head = 0;
+#ifdef DUMPLOG
+    extern unsigned saved_pline_index; /* pline.c */
+#endif
 
     if (restoring_msghist && !initd) {
         /* hide any messages we've gathered since starting current session
@@ -896,12 +899,19 @@ boolean restoring_msghist;
         stash_head = first_mesg, first_mesg = (nhprev_mesg *) 0;
         last_mesg = (nhprev_mesg *) 0; /* no need to remember the tail */
         initd = TRUE;
+#ifdef DUMPLOG
+        /* this suffices; there's no need to scrub saved_pline[] pointers */
+        saved_pline_index = 0;
+#endif
     }
 
     if (msg) {
         mesg_add_line(msg);
         /* treat all saved and restored messages as turn #1 */
         last_mesg->turn = 1L;
+#ifdef DUMPLOG
+        dumplogmsg(last_mesg->str);
+#endif
     } else if (stash_count) {
         nhprev_mesg *mesg;
         long mesg_turn;
@@ -921,6 +931,9 @@ boolean restoring_msghist;
             mesg_add_line(mesg->str);
             /* added line became new tail */
             last_mesg->turn = mesg_turn;
+#ifdef DUMPLOG
+            dumplogmsg(mesg->str);
+#endif
             free((genericptr_t) mesg->str);
             free((genericptr_t) mesg);
         }