]> granicus.if.org Git - nethack/commitdiff
tribute passage 'summary'
authorPatR <rankin@nethack.org>
Wed, 10 Jun 2015 23:23:19 +0000 (16:23 -0700)
committerPatR <rankin@nethack.org>
Wed, 10 Jun 2015 23:23:19 +0000 (16:23 -0700)
When reading a passage from a tribute novel, put the final attribution
line "[$TITLE, by Terry Pratchett]" into message history, comparable to
the summary line for deliver-by-window quest messages.

dat/tribute
src/files.c

index cee54b7f0251c0c0370175cd8ae59c9c36289eb2..7c081388bdac191a847ccd4c4cd9935e820873a5 100644 (file)
@@ -479,7 +479,7 @@ There's a fifth element, and generally it's called Surprise.
 # The Last Hero has never been released in the U.S. (or anywhere?) as a
 # conventional mass market paperback.  The large (roughly 10" by 12")
 # trade paperback contains many full page color illustrations and most
-# text pages include decorations of varying degress of elaborateness.
+# text pages include decorations of varying degrees of elaborateness.
 # The actual text is probably only novella length.
 #
 %title The Last Hero (7)
index 697a1fdd12afdc6581e4916e798cabfbd5b4d4d4..ed361c159fdce143781195b6cd1c1d82c5bbb7e6 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 files.c $NHDT-Date: 1432512772 2015/05/25 00:12:52 $  $NHDT-Branch: master $:$NHDT-Revision: 1.173 $ */
+/* NetHack 3.6 files.c $NHDT-Date: 1433978592 2015/06/10 23:23:12 $  $NHDT-Branch: master $:$NHDT-Revision: 1.175 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -3398,7 +3398,7 @@ int tribpassage;
 {
     dlb *fp;
     char *endp;
-    char line[BUFSZ];
+    char line[BUFSZ], lastline[BUFSZ];
 
     int scope = 0;
     int linect = 0, passagecnt = 0, targetpassage = 0;
@@ -3442,6 +3442,7 @@ int tribpassage;
      *  %section death
      */
 
+    *line = *lastline = '\0';
     while (dlb_fgets(line, sizeof line, fp) != 0) {
         linect++;
         if ((endp = index(line, '\n')) != 0)
@@ -3515,16 +3516,26 @@ int tribpassage;
             /* comment only, next! */
             break;
         default:
-            if (matchedtitle && (scope == PASSAGESCOPE) && tribwin != WIN_ERR)
+            if (matchedtitle && scope == PASSAGESCOPE && tribwin != WIN_ERR) {
                 putstr(tribwin, 0, line);
+                Strcpy(lastline, line);
+            }
         }
     }
 
 cleanup:
     (void) dlb_fclose(fp);
     if (tribwin != WIN_ERR) {
-        if (matchedtitle && (scope == PASSAGESCOPE))
+        if (matchedtitle && scope == PASSAGESCOPE) {
             display_nhwindow(tribwin, FALSE);
+            /* put the final attribution line into message history,
+               analogous to the summary line from long quest messages */
+            if (index(lastline, '['))
+                mungspaces(lastline); /* to remove leading spaces */
+            else /* construct one if necessary */
+                Sprintf(lastline, "[%s, by Terry Pratchett]", tribtitle);
+            putmsghistory(lastline, FALSE);
+        }
         destroy_nhwindow(tribwin);
         tribwin = WIN_ERR;
         grasped = TRUE;