]> granicus.if.org Git - nethack/commitdiff
add #genocided command
authorPatR <rankin@nethack.org>
Sat, 11 Feb 2023 19:35:06 +0000 (11:35 -0800)
committerPatR <rankin@nethack.org>
Sat, 11 Feb 2023 19:35:06 +0000 (11:35 -0800)
Comparable to #vanquished, be able to view info normally available
during end of game disclosure while the game is still in progress.
The new #genocided command lists all genocided and extincted types
of monsters.  Unlike #vanquished, there aren't any sorting choices.

Potential future enhancement:  provide a way to view the genocided
list at the "what do you want to genocide?" prompt.

dat/hh
doc/Guidebook.mn
doc/Guidebook.tex
include/extern.h
src/cmd.c
src/insight.c

diff --git a/dat/hh b/dat/hh
index 386bc68d99835eb22e12e14cbaddbc0a6dd95a5e..951e91460aaa03fcc6054e30d06017c9a68c3bc7 100644 (file)
--- a/dat/hh
+++ b/dat/hh
@@ -124,6 +124,7 @@ M-C   conduct   view optional challenges
 M-d   dip       dip an object into something
 M-e   enhance   show weapon and spell skills, can improve them if eligible
 M-f   force     force a lock
+M-g   genocided list genocided and extinct monster types, if any
 M-i   invoke    invoke an object's special powers
 M-j   jump      jump to another location
 M-l   loot      loot a box on the floor
index 1c8926a4d51d51ddb1d36c8353f07785eeca2d77..ebcf4aa81b23422607681733a04b7715c33e3814 100644 (file)
@@ -1298,6 +1298,10 @@ Default key is \(oqf\(cq.
 Force a lock.
 Autocompletes.
 Default key is \(oqM-f\(cq.
+.lp #genocided
+List any monster types which have been genocided or become extinct.
+Autocompletes.
+Default key is \(oqM-g\(cq.
 .lp "#glance  "
 Show what type of thing a map symbol corresponds to.
 Default key is \(oq;\(cq.
@@ -1867,6 +1871,8 @@ option is enabled)
 #enhance
 .lp M-f
 #force
+.lp M-g
+#genocided
 .lp M-i
 #invoke
 .lp M-j
index 7ef6290998a674ba27f04f72baab7c8c0a7c3556..250876ce6f39f912ce74fb525b08ac9ead5487da 100644 (file)
@@ -1407,6 +1407,11 @@ Default key is `{\tt f}'.
 \item[\tb{\#force}]
 Force a lock. Autocompletes. Default key is `{\tt M-f}'.
 %.lp
+\item[\tb{\#genocided}]
+List any monster types which have been genocided or become extinct.
+Autocompletes.
+Default key is `{\tt M-g}'.
+%.lp
 \item[\tb{\#glance}]
 Show what type of thing a map symbol corresponds to. Default key is `{\tt ;}'.
 %.lp
@@ -2022,6 +2027,9 @@ equivalent is used for another command, so the three key combination
 \item[\tb{M-f}]
 {\tt\#force}
 %.lp
+\item[\tb{M-g}]
+{\tt\#genocided}
+%.lp
 \item[\tb{M-i}]
 {\tt\#invoke}
 %.lp
index 2ef0ad09ba1eb9f804b96b931bbf1ab55cfbfdac..586b0e844b4717c3bcd04b8ff6865c66454bba6f 100644 (file)
@@ -1105,6 +1105,7 @@ extern int doborn(void);
 extern void list_vanquished(char, boolean);
 extern int num_genocides(void);
 extern void list_genocided(char, boolean);
+extern int dogenocided(void);
 extern const char *align_str(aligntyp);
 extern char *piousness(boolean, const char *);
 extern void mstatusline(struct monst *);
index 3f47719eadac049ee5b9205c2ba26d4e3c863518..655f15794a440629a9dcdc5a0367ac17c48bbf6b 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -43,7 +43,7 @@ extern int dofire(void);             /**/
 extern int dothrow(void);            /**/
 extern int doeat(void);              /**/
 extern int done2(void);              /**/
-extern int vanquished(void);         /**/
+extern int dovanquished(void);       /**/
 extern int doengrave(void);          /**/
 extern int dopickup(void);           /**/
 extern int ddoinv(void);             /**/
@@ -2567,6 +2567,9 @@ struct ext_func_tab extcmdlist[] = {
               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 },
     { '?',    "help", "give a help message",
               dohelp, IFBURIED | GENERALCMD, NULL },
     { '\0',   "herecmdmenu", "show menu of commands you can do here",
index ebfa4df36321523891aab369dd33bc2a40e1b465..e3105e4087e06453c0e2bd781962ed94c7ec41ee 100644 (file)
@@ -2826,7 +2826,7 @@ list_vanquished(char defquery, boolean ask)
      * which needs putstr() and past tense.
      */
     } else if (!gp.program_state.gameover) {
-        /* #dovanquished rather than final disclosure, so pline() is ok */
+        /* #vanquished rather than final disclosure, so pline() is ok */
         pline("No creatures have been vanquished.");
 #ifdef DUMPLOG
     } else if (dumping) {
@@ -2852,6 +2852,7 @@ num_genocides(void)
     return n;
 }
 
+/* return a count of the number of extinct species */
 static int
 num_extinct(void)
 {
@@ -2866,6 +2867,8 @@ num_extinct(void)
     return n;
 }
 
+/* show genocided and extinct monster types for final disclosure/dumplog
+   or for the #genocided command */
 void
 list_genocided(char defquery, boolean ask)
 {
@@ -2933,6 +2936,11 @@ list_genocided(char defquery, boolean ask)
             display_nhwindow(klwin, TRUE);
             destroy_nhwindow(klwin);
         }
+
+    /* See the comment for similar code near the end of list_vanquished(). */
+    } else if (!gp.program_state.gameover) {
+        /* #genocided rather than final disclosure, so pline() is ok */
+        pline("No creatures have been genocided or become extinct.");
 #ifdef DUMPLOG
     } else if (dumping) {
         putstr(0, 0, "No species were genocided or became extinct.");
@@ -2940,6 +2948,14 @@ list_genocided(char defquery, boolean ask)
     }
 }
 
+/* M-g - #genocided command */
+int
+dogenocided(void)
+{
+    list_genocided('y', FALSE);
+    return ECMD_OK;
+}
+
 /*
  * align_str(), piousness(), mstatusline() and ustatusline() once resided
  * in pline.c, then got moved to priest.c just to be out of there.  They