X Tutup
Skip to content

Commit f6b3b96

Browse files
author
PatR
committed
change #vanquished from wizard mode to normal play
Make the existing '#vanquished' command be available during regular play, with M-V bound to it. 'm #vanquished' or 'm M-V' brings up the sorting menu that you get when answering 'a' rather than 'y' at the end-of-game "disclose vanquished creatures?" prompt. The original #vanquished came from slash'em, where it was available in normal play. When added to nethack, it was put in as wizard-mode- only. I added the sorting capability several years ago. The chosen sort is remembered and re-used if not reset but only for the remainder of the current session. It probably ought of become a run-time option so be settable in advance and across sessions but I haven't done that.
1 parent 5ac048c commit f6b3b96

File tree

7 files changed

+76
-32
lines changed

7 files changed

+76
-32
lines changed

dat/hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ M-s sit sit down
140140
M-t turn turn undead if role allows that
141141
M-T tip upend a container to dump out its contents
142142
M-u untrap untrap something
143+
M-V vanquished list number and type of vanquished monsters
143144
M-v version print compile time options for this version
144145
M-w wipe wipe off your face
145146
M-X explore switch from regular play to non-scoring explore mode

dat/wizhelp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Debug-Mode Quick Reference:
1919
#stats == show memory statistics
2020
#terrain == show current level (more options than in normal play)
2121
#timeout == look at timeout queue and hero's timed intrinsics
22-
#vanquished == disclose counts of dead monsters sorted in various ways
2322
#vision == show vision array
2423
#wizborn == show monster birth/death/geno/extinct stats
2524
#wizcast == cast any spell

doc/Guidebook.mn

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,9 +1672,22 @@ In some circumstances it can also be used to rescue trapped monsters.
16721672
Go up a staircase.
16731673
Default key is \(oq<\(cq.
16741674
.lp #vanquished
1675-
List vanquished monsters.
1675+
List vanquished monsters by type and count.
1676+
.lp ""
1677+
Note that the vanquished monsters list includes all monsters killed by
1678+
traps and each other as well as by you, and omits any which got removed
1679+
from the game without being killed (perhaps by genocide, or by a mollified
1680+
shopkeeper dismissing summoned Kops).
1681+
.lp ""
1682+
Using the \(lqrequest menu\(rq prefix prior to #vanquished brings up
1683+
a menu of sorting orders available.
1684+
Whichever one is picked is remembered for subsequent #vanquished commands
1685+
during the current play session but not saved and restored across sessions.
1686+
During end-of-game disclosure, when asked whether to show vanquished
1687+
monsters answering \(oq\f(CRa\fP\(cq will let you choose from the sort menu.
1688+
.lp ""
16761689
Autocompletes.
1677-
Debug mode only.
1690+
Default key is \(oqM-V\(cq.
16781691
.lp "#version "
16791692
Print compile time options for this version of NetHack.
16801693
.lp ""
@@ -1875,6 +1888,8 @@ option is enabled)
18751888
#untrap
18761889
.lp M-v
18771890
#version
1891+
.lp M-V
1892+
#vanquished
18781893
.lp M-w
18791894
#wipe
18801895
.lp M-X

doc/Guidebook.tex

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,9 +1795,25 @@ \section{Commands}
17951795
Go up a staircase. Default key is `{\tt <}'.
17961796
%.lp
17971797
\item[\tb{\#vanquished}]
1798-
List vanquished monsters.
1798+
List vanquished monsters by type and count.
1799+
\\
1800+
%.lp ""
1801+
Note that the vanquished monsters list includes all monsters killed by
1802+
traps and each other as well as by you, and omits any which got removed
1803+
from the game without being killed (perhaps by genocide, or by a mollified
1804+
shopkeeper dismissing summoned Kops).
1805+
\\
1806+
%.lp ""
1807+
Using the ``request menu'' prefix prior to \#vanquished brings up
1808+
a menu of sort orders available.
1809+
Whichever one is picked is remembered for subsequent \#vanquished commands
1810+
during the current play session but not saved and restored across sessions.
1811+
During end-of-game disclosure, when asked whether to show vanquished
1812+
monsters answering `{\tt a}' will let you choose from the sort menu.
1813+
\\
1814+
%.lp ""
17991815
Autocompletes.
1800-
Debug mode only.
1816+
Default key is `{\tt M-V}'.
18011817
%.lp
18021818
\item[\tb{\#version}]
18031819
Print compile time options for this version of {\it NetHack\/}.
@@ -2041,6 +2057,9 @@ \section{Commands}
20412057
\item[\tb{M-v}]
20422058
{\tt\#version}
20432059
%.lp
2060+
\item[\tb{M-V}]
2061+
{\tt\#vanquished}
2062+
%.lp
20442063
\item[\tb{M-w}]
20452064
{\tt\#wipe}
20462065
%.lp

doc/fixes3-7-0.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,6 +1874,7 @@ add some tins of spinach to monk's quest (vegan => no Str from giant corpses)
18741874
very large humanoids can wear mummy wrappings
18751875
for ranger characters, shooting any type of arrow while wielding the Longbow
18761876
of Diana gets an extra +1 to multi-shot
1877+
change the #vanquished command from debug-only to general user command
18771878

18781879

18791880
Platform- and/or Interface-Specific New Features

src/cmd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,8 +2724,8 @@ struct ext_func_tab extcmdlist[] = {
27242724
{ '<', "up", "go up a staircase",
27252725
/* (see comment for dodown() above */
27262726
doup, CMD_M_PREFIX, NULL },
2727-
{ '\0', "vanquished", "list vanquished monsters",
2728-
dovanquished, IFBURIED | AUTOCOMPLETE | WIZMODECMD, NULL },
2727+
{ M('V'), "vanquished", "list vanquished monsters",
2728+
dovanquished, IFBURIED | AUTOCOMPLETE | CMD_M_PREFIX, NULL },
27292729
{ M('v'), "version",
27302730
"list compile time options for this version of NetHack",
27312731
doextversion, IFBURIED | AUTOCOMPLETE | GENERALCMD, NULL },

src/insight.c

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,19 +2485,22 @@ show_gamelog(int final)
24852485
* Vanquished monsters.
24862486
*/
24872487

2488-
static const char *vanqorders[NUM_VANQ_ORDER_MODES] = {
2489-
"traditional: by monster level, by internal monster index",
2490-
"by monster toughness, by internal monster index",
2491-
"alphabetically, first unique monsters, then others",
2492-
"alphabetically, unique monsters and others intermixed",
2493-
"by monster class, high to low level within class",
2494-
"by monster class, low to high level within class",
2495-
"by count, high to low, by internal index within tied count",
2496-
"by count, low to high, by internal index within tied count",
2488+
/* the two uppercase choices are implemented but suppressed from menu */
2489+
static const char *vanqorders[NUM_VANQ_ORDER_MODES][2] = {
2490+
{ "t", "traditional: by monster level, by internal monster index" },
2491+
{ "d", "by monster difficulty rating, by internal monster index" },
2492+
{ "a", "alphabetically, first unique monsters, then others" },
2493+
{ "A", "alphabetically, unique monsters and others intermixed" },
2494+
{ "C", "by monster class, high to low level within class" },
2495+
{ "c", "by monster class, low to high level within class" },
2496+
{ "n", "by count, high to low, by internal index within tied count" },
2497+
{ "z", "by count, low to high, by internal index within tied count" },
24972498
};
24982499

24992500
static int QSORTCALLBACK
2500-
vanqsort_cmp(const genericptr vptr1, const genericptr vptr2)
2501+
vanqsort_cmp(
2502+
const genericptr vptr1,
2503+
const genericptr vptr2)
25012504
{
25022505
int indx1 = *(short *) vptr1, indx2 = *(short *) vptr2,
25032506
mlev1, mlev2, mstr1, mstr2, uniq1, uniq2, died1, died2, res;
@@ -2508,12 +2511,14 @@ vanqsort_cmp(const genericptr vptr1, const genericptr vptr2)
25082511
default:
25092512
case VANQ_MLVL_MNDX:
25102513
/* sort by monster level */
2511-
mlev1 = mons[indx1].mlevel, mlev2 = mons[indx2].mlevel;
2514+
mlev1 = mons[indx1].mlevel;
2515+
mlev2 = mons[indx2].mlevel;
25122516
res = mlev2 - mlev1; /* mlevel high to low */
25132517
break;
25142518
case VANQ_MSTR_MNDX:
25152519
/* sort by monster toughness */
2516-
mstr1 = mons[indx1].difficulty, mstr2 = mons[indx2].difficulty;
2520+
mstr1 = mons[indx1].difficulty;
2521+
mstr2 = mons[indx2].difficulty;
25172522
res = mstr2 - mstr1; /* monstr high to low */
25182523
break;
25192524
case VANQ_ALPHA_SEP:
@@ -2525,8 +2530,8 @@ vanqsort_cmp(const genericptr vptr1, const genericptr vptr2)
25252530
} /* else both unique or neither unique */
25262531
/*FALLTHRU*/
25272532
case VANQ_ALPHA_MIX:
2528-
name1 = mons[indx1].pmnames[NEUTRAL],
2529-
name2 = mons[indx2].pmnames[NEUTRAL];
2533+
name1 = mons[indx1].pmnames[NEUTRAL];
2534+
name2 = mons[indx2].pmnames[NEUTRAL];
25302535
res = strcmpi(name1, name2); /* caseblind alhpa, low to high */
25312536
break;
25322537
case VANQ_MCLS_HTOL:
@@ -2535,7 +2540,8 @@ vanqsort_cmp(const genericptr vptr1, const genericptr vptr2)
25352540
if 'char' happens to be unsigned, (mlet1 - mlet2) would yield
25362541
an inappropriate result when mlet2 is greater than mlet1,
25372542
so force our copies (mcls1, mcls2) to be signed */
2538-
mcls1 = (schar) mons[indx1].mlet, mcls2 = (schar) mons[indx2].mlet;
2543+
mcls1 = (schar) mons[indx1].mlet;
2544+
mcls2 = (schar) mons[indx2].mlet;
25392545
/* S_ANT through S_ZRUTY correspond to lowercase monster classes,
25402546
S_ANGEL through S_ZOMBIE correspond to uppercase, and various
25412547
punctuation characters are used for classes beyond those */
@@ -2555,15 +2561,17 @@ vanqsort_cmp(const genericptr vptr1, const genericptr vptr2)
25552561
}
25562562
res = mcls1 - mcls2; /* class */
25572563
if (res == 0) {
2558-
mlev1 = mons[indx1].mlevel, mlev2 = mons[indx2].mlevel;
2564+
mlev1 = mons[indx1].mlevel;
2565+
mlev2 = mons[indx2].mlevel;
25592566
res = mlev1 - mlev2; /* mlevel low to high */
25602567
if (g.vanq_sortmode == VANQ_MCLS_HTOL)
25612568
res = -res; /* mlevel high to low */
25622569
}
25632570
break;
25642571
case VANQ_COUNT_H_L:
25652572
case VANQ_COUNT_L_H:
2566-
died1 = g.mvitals[indx1].died, died2 = g.mvitals[indx2].died;
2573+
died1 = g.mvitals[indx1].died;
2574+
died2 = g.mvitals[indx2].died;
25672575
res = died2 - died1; /* dead count high to low */
25682576
if (g.vanq_sortmode == VANQ_COUNT_L_H)
25692577
res = -res; /* dead count low to high */
@@ -2592,10 +2600,10 @@ set_vanq_order(void)
25922600
if (i == VANQ_ALPHA_MIX || i == VANQ_MCLS_HTOL) /* skip these */
25932601
continue;
25942602
any.a_int = i + 1;
2595-
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr,
2596-
vanqorders[i],
2597-
(i == g.vanq_sortmode)
2598-
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
2603+
add_menu(tmpwin, &nul_glyphinfo, &any, *vanqorders[i][0], 0,
2604+
ATR_NONE, clr, vanqorders[i][1],
2605+
(i == g.vanq_sortmode) ? MENU_ITEMFLAGS_SELECTED
2606+
: MENU_ITEMFLAGS_NONE);
25992607
}
26002608
end_menu(tmpwin, "Sort order for vanquished monster counts");
26012609

@@ -2616,7 +2624,7 @@ set_vanq_order(void)
26162624
int
26172625
dovanquished(void)
26182626
{
2619-
list_vanquished('a', FALSE);
2627+
list_vanquished(iflags.menu_requested ? 'a' : 'y', FALSE);
26202628
return ECMD_OK;
26212629
}
26222630

@@ -2706,15 +2714,16 @@ list_vanquished(char defquery, boolean ask)
27062714
if (c == 'q')
27072715
done_stopprint++;
27082716
if (c == 'y' || c == 'a') {
2709-
if (c == 'a') { /* ask player to choose sort order */
2717+
if (c == 'a' && ntypes > 1) { /* ask player to choose sort order */
27102718
/* choose value for vanq_sortmode via menu; ESC cancels list
27112719
of vanquished monsters but does not set 'done_stopprint' */
27122720
if (set_vanq_order() < 0)
27132721
return;
27142722
}
27152723
uniq_header = (g.vanq_sortmode == VANQ_ALPHA_SEP);
2716-
class_header = (g.vanq_sortmode == VANQ_MCLS_LTOH
2717-
|| g.vanq_sortmode == VANQ_MCLS_HTOL);
2724+
class_header = ((g.vanq_sortmode == VANQ_MCLS_LTOH
2725+
|| g.vanq_sortmode == VANQ_MCLS_HTOL)
2726+
&& ntypes > 1);
27182727

27192728
klwin = create_nhwindow(NHW_MENU);
27202729
putstr(klwin, 0, "Vanquished creatures:");

0 commit comments

Comments
 (0)
X Tutup