MCPcopy Create free account
hub / github.com/NetHack/NetHack / list_vanquished

Function list_vanquished

src/insight.c:2783–2949  ·  view source on GitHub ↗

used for #vanquished and end of game disclosure and end of game dumplog */

Source from the content-addressed store, hash-verified

2781
2782/* used for #vanquished and end of game disclosure and end of game dumplog */
2783void
2784list_vanquished(char defquery, boolean ask)
2785{
2786 int i;
2787 int pfx, nkilled;
2788 unsigned ntypes, ni;
2789 long total_killed = 0L;
2790 winid klwin;
2791 short mindx[NUMMONS];
2792 char c, buf[BUFSZ], buftoo[BUFSZ];
2793 /* 'A' is only supplied by 'm #vanquished'; 'd' is only supplied by
2794 dump_everything() when writing dumplog, so won't happen if built
2795 without '#define DUMPLOG' but there's no need for conditionals here */
2796 boolean force_sort = (defquery == 'A'),
2797 dumping = (defquery == 'd');
2798
2799 /* normally we don't ask about sort order for the vanquished list unless
2800 it contains at least two entries; however, if player has used explicit
2801 'm #vanquished', choose order no matter what it contains so far */
2802 if (force_sort) { /* iflags.menu_requested via dovanquished() */
2803 /* choose value for vanq_sortmode via menu; ESC cancels choosing
2804 sort order but continues with vanquishd monsters display */
2805 (void) set_vanq_order(TRUE);
2806 }
2807 if (dumping || force_sort) {
2808 /* switch from 'A' or 'd' to 'y'; 'ask' is already False for the
2809 cases that might supply 'A' or 'd' */
2810 defquery = 'y';
2811 ask = FALSE; /* redundant */
2812 }
2813
2814 /* get totals first */
2815 ntypes = 0;
2816 for (i = LOW_PM; i < NUMMONS; i++) {
2817 if ((nkilled = (int) svm.mvitals[i].died) == 0)
2818 continue;
2819 mindx[ntypes++] = i;
2820 total_killed += (long) nkilled;
2821 }
2822
2823 /* vanquished creatures list;
2824 * includes all dead monsters, not just those killed by the player
2825 */
2826 if (ntypes != 0) {
2827 char mlet, prev_mlet = 0; /* used as small integer, not character */
2828 boolean class_header, uniq_header, Rider,
2829 was_uniq = FALSE, special_hdr = FALSE;
2830
2831 if (ask) {
2832 char allow_yn[10];
2833
2834 if (ntypes > 1) {
2835 Strcpy(allow_yn, ynaqchars);
2836 } else {
2837 Strcpy(allow_yn, ynqchars); /* don't include 'a', but */
2838 Strcat(allow_yn, "\033a"); /* allow user to answer 'a' */
2839 if (defquery == 'a') /* potential default from 'disclose' */
2840 defquery = 'y';

Callers 3

dump_everythingFunction · 0.85
discloseFunction · 0.85
dovanquishedFunction · 0.85

Calls 11

set_vanq_orderFunction · 0.85
yn_functionFunction · 0.85
qsortFunction · 0.85
upstartFunction · 0.85
eosFunction · 0.85
N_timesFunction · 0.85
anFunction · 0.85
makepluralFunction · 0.85
digitFunction · 0.85
strncmpiFunction · 0.70
plineFunction · 0.70

Tested by

no test coverage detected