From ed300e5fa897ce702901cab43829bc3a8e99045d Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 6 Mar 2017 00:22:00 -0800 Subject: [PATCH] dumplog fixes: genocide list, survivor's tombstone 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 | 4 ++++ src/end.c | 53 +++++++++++++++++++++++++++++++++++++-------------- src/rip.c | 15 ++++++++++++--- 3 files changed, 55 insertions(+), 17 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 39188f466..761d1e02e 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -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 diff --git a/src/end.c b/src/end.c index f0d3e2f07..c906c10b9 100644 --- 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 } } diff --git a/src/rip.c b/src/rip.c index 64bd8dd01..11abaea63 100644 --- 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]); -- 2.50.1