]> granicus.if.org Git - nethack/commitdiff
dumplog fixes: genocide list, survivor's tombstone
authorPatR <rankin@nethack.org>
Mon, 6 Mar 2017 08:22:00 +0000 (00:22 -0800)
committerPatR <rankin@nethack.org>
Mon, 6 Mar 2017 08:22:00 +0000 (00:22 -0800)
The dumplog data was including a final tombstone unconditionally,
which looked awfully strange for characters who didn't die.  Make
it conditional, like actual end-of-game tombstone.  (One difference
though:  dumplog has a tombstone for hero who died from genocide,
end-of-game does not.  I think the latter should display one even
though no grave gets generated.)  [Potential for future enhancement:
add some alternate ascii art in place of tombstone for survivors.]

The list of genocided and/or extincted species was never shown
since caller passed 'a' to list_genocided() and it expected 'y'.
Also, once shown, the list entries were lacking indentation that
other sections of the dump generally have.

Both vanquished monsters and genocided/extinct monsters included
a blank line separator even when there was no feedback, making a
noticeable gap in the dumplog text.  Have them report "no creatures
vanquished" and "no species genocided", when applicable, so that
their separator lines always have something to separate.

When dumping, omit a couple of blank lines each from vanquished
creatures list, genocided species list, and tombstone so the
relevant sections of the dump are more compact.

doc/fixes36.1
src/end.c
src/rip.c

index 39188f466c7cb9eec07e1eeea5a2b06cb7abfc4e..761d1e02ebb70a7954c88792d0d7d3a33c3b0cad 100644 (file)
@@ -394,6 +394,10 @@ when autopickup is overridden in a shop, always-pick-up exceptions and
 the fix for giving an alternate grow up message when a monster becomes a new
        form with the opposite sex (female gnome into male gnome lord, for
        example) had the logic wrong
+DUMPLOG: genocided and extinct species was always a blank line;
+       vanquished creatures was just a blank line if nothing had been killed
+DUMPLOG: RIP tombstone was printed for characters who survived (ascended,
+       escaped dungeon, quit, trickery or panic)
 
 
 Platform- and/or Interface-Specific Fixes
index f0d3e2f0709435bdac3e8d1229dee55090f568fd..c906c10b9422a04ac7c46e22663d864efd40c60b 100644 (file)
--- a/src/end.c
+++ b/src/end.c
@@ -1,4 +1,4 @@
-/* NetHack 3.6 end.c   $NHDT-Date: 1488075979 2017/02/26 02:26:19 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.127 $ */
+/* NetHack 3.6 end.c   $NHDT-Date: 1488788512 2017/03/06 08:21:52 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.129 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -737,12 +737,11 @@ int how;
     display_inventory((char *) 0, TRUE);
     container_contents(invent, TRUE, TRUE, FALSE);
     enlightenment((BASICENLIGHTENMENT | MAGICENLIGHTENMENT),
-        (how >= PANICKED) ? ENL_GAMEOVERALIVE
-        : ENL_GAMEOVERDEAD);
+                  (how >= PANICKED) ? ENL_GAMEOVERALIVE : ENL_GAMEOVERDEAD);
     putstr(0, 0, "");
-    list_vanquished('y', FALSE);
+    list_vanquished('d', FALSE); /* 'd' => 'y' */
     putstr(0, 0, "");
-    list_genocided('a', FALSE);
+    list_genocided('d', FALSE); /* 'd' => 'y' */
     putstr(0, 0, "");
     show_conduct((how >= PANICKED) ? 1 : 2);
     putstr(0, 0, "");
@@ -1270,9 +1269,13 @@ int how;
         done_stopprint = 1; /* just avoid any more output */
 
 #ifdef DUMPLOG
-    dump_redirect(TRUE);
-    genl_outrip(0, how, endtime);
-    dump_redirect(FALSE);
+    /* 'how' reasons beyond genocide shouldn't show tombstone;
+       for normal end of game, genocide doesn't either */
+    if (how <= GENOCIDED) {
+        dump_redirect(TRUE);
+        genl_outrip(0, how, endtime);
+        dump_redirect(FALSE);
+    }
 #endif
     if (u.uhave.amulet) {
         Strcat(killer.name, " (with the Amulet)");
@@ -1687,7 +1690,7 @@ dovanquished()
 
 /* high priests aren't unique but are flagged as such to simplify something */
 #define UniqCritterIndx(mndx) ((mons[mndx].geno & G_UNIQ) \
-                             && mndx != PM_HIGH_PRIEST)
+                               && mndx != PM_HIGH_PRIEST)
 
 STATIC_OVL void
 list_vanquished(defquery, ask)
@@ -1701,6 +1704,11 @@ boolean ask;
     winid klwin;
     short mindx[NUMMONS];
     char c, buf[BUFSZ], buftoo[BUFSZ];
+    boolean dumping; /* for DUMPLOG; doesn't need to be conditional */
+
+    dumping = (defquery == 'd');
+    if (dumping)
+        defquery = 'y';
 
     /* get totals first */
     ntypes = 0;
@@ -1737,7 +1745,8 @@ boolean ask;
 
             klwin = create_nhwindow(NHW_MENU);
             putstr(klwin, 0, "Vanquished creatures:");
-            putstr(klwin, 0, "");
+            if (!dumping)
+                putstr(klwin, 0, "");
 
             qsort((genericptr_t) mindx, ntypes, sizeof *mindx, vanqsort_cmp);
             for (ni = 0; ni < ntypes; ni++) {
@@ -1796,7 +1805,8 @@ boolean ask;
              *     putstr(klwin, 0, "and a partridge in a pear tree");
              */
             if (ntypes > 1) {
-                putstr(klwin, 0, "");
+                if (!dumping)
+                    putstr(klwin, 0, "");
                 Sprintf(buf, "%ld creatures vanquished.", total_killed);
                 putstr(klwin, 0, buf);
             }
@@ -1806,6 +1816,10 @@ boolean ask;
     } else if (defquery == 'a') {
         /* #dovanquished rather than final disclosure, so pline() is ok */
         pline("No monsters have been vanquished.");
+#ifdef DUMPLOG
+    } else if (dumping) {
+        putstr(0, 0, "No monsters were vanquished."); /* not pline() */
+#endif
     }
 }
 
@@ -1850,6 +1864,11 @@ boolean ask;
     char c;
     winid klwin;
     char buf[BUFSZ];
+    boolean dumping; /* for DUMPLOG; doesn't need to be conditional */
+
+    dumping = (defquery == 'd');
+    if (dumping)
+        defquery = 'y';
 
     ngenocided = num_genocides();
     nextinct = num_extinct();
@@ -1869,7 +1888,8 @@ boolean ask;
                     (ngenocided) ? "Genocided" : "Extinct",
                     (nextinct && ngenocided) ? " or extinct" : "");
             putstr(klwin, 0, buf);
-            putstr(klwin, 0, "");
+            if (!dumping)
+                putstr(klwin, 0, "");
 
             for (i = LOW_PM; i < NUMMONS; i++) {
                 /* uniques can't be genocided but can become extinct;
@@ -1877,7 +1897,7 @@ boolean ask;
                 if (UniqCritterIndx(i))
                     continue;
                 if (mvitals[i].mvflags & G_GONE) {
-                    Strcpy(buf, makeplural(mons[i].mname));
+                    Sprintf(buf, " %s", makeplural(mons[i].mname));
                     /*
                      * "Extinct" is unfortunate terminology.  A species
                      * is marked extinct when its birth limit is reached,
@@ -1889,7 +1909,8 @@ boolean ask;
                     putstr(klwin, 0, buf);
                 }
             }
-            putstr(klwin, 0, "");
+            if (!dumping)
+                putstr(klwin, 0, "");
             if (ngenocided > 0) {
                 Sprintf(buf, "%d species genocided.", ngenocided);
                 putstr(klwin, 0, buf);
@@ -1902,6 +1923,10 @@ boolean ask;
             display_nhwindow(klwin, TRUE);
             destroy_nhwindow(klwin);
         }
+#ifdef DUMPLOG
+    } else if (dumping) {
+        putstr(0, 0, "No species were genocided or became extinct.");
+#endif
     }
 }
 
index 64bd8dd01842ac072dd6024ce9a8a3a55c2b6fac..11abaea637fa19b6bb432bcdc3e0c18121f50d8a 100644 (file)
--- a/src/rip.c
+++ b/src/rip.c
@@ -1,4 +1,4 @@
-/* NetHack 3.6 rip.c   $NHDT-Date: 1450432760 2015/12/18 09:59:20 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.22 $ */
+/* NetHack 3.6 rip.c   $NHDT-Date: 1488788514 2017/03/06 08:21:54 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.23 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -141,12 +141,21 @@ time_t when;
     Sprintf(buf, "%4ld", year);
     center(YEAR_LINE, buf);
 
-    putstr(tmpwin, 0, "");
+#ifdef DUMPLOG
+    if (tmpwin == 0)
+        dump_forward_putstr(0, 0, "Gave over:", TRUE);
+    else
+#endif
+        putstr(tmpwin, 0, "");
+
     for (; *dp; dp++)
         putstr(tmpwin, 0, *dp);
 
     putstr(tmpwin, 0, "");
-    putstr(tmpwin, 0, "");
+#ifdef DUMPLOG
+    if (tmpwin != 0)
+#endif
+        putstr(tmpwin, 0, "");
 
     for (x = 0; rip_txt[x]; x++) {
         free((genericptr_t) rip[x]);