\#genocided revision

The #genocided command was revealing extinct monster species when used
during normal play.  That was not intended, so stop.  Change to only
reveal them in wizard or explore modes and also during end-of-game
disclosure but suppress them during normal play.

The full description of #genocided is now dynamically updated for '# ?'
during normal play to remove its reference to extinctions.  Also, check
for skipping wizard mode commands before doing description searching.

\#genocided was out of alphabetical order in the full commands list.
Both it and #vanquished should have had the GENERALCMD flag; they
don't affect game state.

Change #genocided to use the sort order currently set for #vanquished,
and allow 'm #genocided' to put up the same menu as 'm #vanquished'.
(Not quite the same.  Sorting by count of monster deaths isn't
appropriate for listing genocides where an arbitrary number may have
been killed before the genocide occurred.  If the preferred order for
vanquished is set that way, alphabetical will be used for genocided.)

Setting the order via menu for either command sets the order for both,
but doing so via #genocided doesn't offer the count-high-to-low and
count-low-to-high choices.  During disclosure, you can answer 'a' when
asked whether to disclose genocided and extinct monster types and like
for vanquished monsters, that lets you choose an order at end-of-game.
Doing so won't affect disclosing of vanquished monsters--it'll be too
late for them.

A chunk of this diff is due to moving the #wizborn code out of the
middle of #vanquished handling.

Guidebook.ms has been updated but Guidebook.tex is lagging.
This commit is contained in:
PatR
2023-05-03 04:58:39 -07:00
parent 654b7d41b2
commit e48c6bdc00
5 changed files with 214 additions and 102 deletions

View File

@@ -581,7 +581,8 @@ int
doextlist(void)
{
register const struct ext_func_tab *efp = (struct ext_func_tab *) 0;
char buf[BUFSZ], searchbuf[BUFSZ], promptbuf[QBUFSZ];
char buf[BUFSZ], searchbuf[BUFSZ], descbuf[BUFSZ], promptbuf[QBUFSZ];
const char *cmd_desc;
winid menuwin;
anything any;
menu_item *selected;
@@ -654,21 +655,11 @@ doextlist(void)
for (efp = extcmdlist; efp->ef_txt; efp++) {
int wizc;
if ((efp->flags & (CMD_NOT_AVAILABLE|INTERNALCMD)) != 0)
if ((efp->flags & (CMD_NOT_AVAILABLE | INTERNALCMD)) != 0)
continue;
/* if hiding non-autocomplete commands, skip such */
if (menumode == 1 && (efp->flags & AUTOCOMPLETE) == 0)
continue;
/* if searching, skip this command if it doesn't match */
if (*searchbuf
/* first try case-insensitive substring match */
&& !strstri(efp->ef_txt, searchbuf)
&& !strstri(efp->ef_desc, searchbuf)
/* wildcard support; most interfaces use case-insensitive
pmatch rather than regexp for menu searching */
&& !pmatchi(searchbuf, efp->ef_txt)
&& !pmatchi(searchbuf, efp->ef_desc))
continue;
/* skip wizard mode commands if not in wizard mode;
when showing two sections, skip wizard mode commands
in pass==0 and skip other commands in pass==1 */
@@ -677,6 +668,26 @@ doextlist(void)
continue;
if (!onelist && pass != wizc)
continue;
/* command descripton might get modified on the fly */
cmd_desc = efp->ef_desc;
/* suppress part of the descripton for #genocided if it
doesn't apply during the current game */
if (!wizard && !discover
&& (efp->flags & GENERALCMD) != 0 /* minor optimization */
&& strstri(cmd_desc, "extinct"))
cmd_desc = strsubst(strcpy(descbuf, cmd_desc),
" been genocided or become extinct",
" been genocided");
/* if searching, skip this command if it doesn't match */
if (*searchbuf
/* first try case-insensitive substring match */
&& !strstri(efp->ef_txt, searchbuf)
&& !strstri(cmd_desc, searchbuf)
/* wildcard support; most interfaces use case-insensitive
pmatch rather than regexp for menu searching */
&& !pmatchi(searchbuf, efp->ef_txt)
&& !pmatchi(searchbuf, cmd_desc))
continue;
/* We're about to show an item, have we shown the menu yet?
Doing menu in inner loop like this on demand avoids a
@@ -692,7 +703,7 @@ doextlist(void)
/* longest ef_txt at present is "wizrumorcheck" (13 chars);
2nd field will be " " or " [A]" or " [m]" or "[mA]" */
Sprintf(buf, " %-14s %4s %s", efp->ef_txt,
doc_extcmd_flagstr(menuwin, efp), efp->ef_desc);
doc_extcmd_flagstr(menuwin, efp), cmd_desc);
add_menu(menuwin, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
clr, buf, MENU_ITEMFLAGS_NONE);
++n;
@@ -2581,11 +2592,12 @@ struct ext_func_tab extcmdlist[] = {
dofire, 0, NULL },
{ M('f'), "force", "force a lock",
doforce, AUTOCOMPLETE, NULL },
{ ';', "glance", "show what type of thing a map symbol corresponds to",
doquickwhatis, IFBURIED | GENERALCMD, NULL },
{ M('g'), "genocided",
"list monsters that have been genocided or become extinct",
dogenocided, IFBURIED | AUTOCOMPLETE, NULL },
dogenocided,
IFBURIED | AUTOCOMPLETE | GENERALCMD | CMD_M_PREFIX, NULL },
{ ';', "glance", "show what type of thing a map symbol corresponds to",
doquickwhatis, IFBURIED | GENERALCMD, NULL },
{ '?', "help", "give a help message",
dohelp, IFBURIED | GENERALCMD, NULL },
{ '\0', "herecmdmenu", "show menu of commands you can do here",
@@ -2768,7 +2780,8 @@ struct ext_func_tab extcmdlist[] = {
/* (see comment for dodown() above */
doup, CMD_M_PREFIX, NULL },
{ M('V'), "vanquished", "list vanquished monsters",
dovanquished, IFBURIED | AUTOCOMPLETE | CMD_M_PREFIX, NULL },
dovanquished,
IFBURIED | AUTOCOMPLETE | GENERALCMD | CMD_M_PREFIX, NULL },
{ M('v'), "version",
"list compile time options for this version of NetHack",
doextversion, IFBURIED | AUTOCOMPLETE | GENERALCMD, NULL },