From 0a7cdeae3cc3d3ec9117dda7b61bb4a1beef5e3a Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 9 Sep 2023 16:56:24 -0700 Subject: [PATCH] viewing geno'd monsters at "genocide what?" prompt At either of the genocide prompts, |What type of monster do you want to genocide? or |What class of monsters do you want to genocide? answering "?" will show the list of monster types that have already been genocided, then re-prompt. --- doc/fixes3-7-0.txt | 3 +++ src/insight.c | 12 ++++++++---- src/read.c | 32 ++++++++++++++++++++++++++------ 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 07c3f4d20..9df8fde6b 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -2234,6 +2234,9 @@ new status highlight rule type for hitpoints: "criticalhp" rule overrides hit point rules if current HP is so low that prayer will consider it to be major problem; applies to hitpointbar as well as HP status high skill level in martial arts or bare-handed combat sometimes hits twice +answering '?' at the "genocide what?" prompt (for either monster class + or single species) runs the #genocided command to show what types of + monsters have already been genocided and then re-prompts Platform- and/or Interface-Specific New Features diff --git a/src/insight.c b/src/insight.c index 594d08b57..e953c5903 100644 --- a/src/insight.c +++ b/src/insight.c @@ -2882,14 +2882,18 @@ list_genocided(char defquery, boolean ask) char c; winid klwin; char buf[BUFSZ]; - boolean dumping; /* for DUMPLOG; doesn't need to be conditional */ + boolean genoing, /* prompting for genocide or class genocide */ + dumping; /* for DUMPLOG; doesn't need to be conditional */ boolean both = (gp.program_state.gameover || wizard || discover); dumping = (defquery == 'd'); - if (dumping) + genoing = (defquery == 'g'); + if (dumping || genoing) defquery = 'y'; + if (genoing) + both = FALSE; /* genocides only, not extinctions */ - /* this goess through the whole monster list up to three times but will + /* this goes through the whole monster list up to three times but will happen rarely and is simpler than a more general single pass check; extinctions are only revealed during end of game disclosure or when running in wizard or explore mode */ @@ -2985,7 +2989,7 @@ list_genocided(char defquery, boolean ask) } else if (!gp.program_state.gameover) { /* #genocided rather than final disclosure, so pline() is ok and extinction has been ignored */ - pline("No creatures have been genocided."); + pline("No creatures have been genocided%s.", genoing ? " yet" : ""); #ifdef DUMPLOG } else if (dumping) { /* 'gameover' is True if we make it here */ putstr(0, 0, "No species were genocided or became extinct."); diff --git a/src/read.c b/src/read.c index f8f39f811..697eb779d 100644 --- a/src/read.c +++ b/src/read.c @@ -2506,15 +2506,18 @@ do_class_genocide(void) boolean gameover = FALSE; /* true iff killed self */ buf[0] = '\0'; /* for EDIT_GETLIN */ - for (j = 0;; j++) { + for (j = 0; ; j++) { if (j >= 5) { pline1(thats_enough_tries); return; } Strcpy(promptbuf, "What class of monsters do you want to genocide?"); - if (iflags.cmdassist && j > 0) - Strcat(promptbuf, - " [enter the symbol or name representing a class]"); + if (j > 0) + Snprintf(eos(promptbuf), sizeof promptbuf - strlen(promptbuf), + " [enter %s]", + iflags.cmdassist + ? "the symbol or name representing a class, or '?'" + : "'?' to see previous genocides"); getlin(promptbuf, buf); (void) mungspaces(buf); /* avoid 'that does not represent any monster' for empty input */ @@ -2534,6 +2537,13 @@ do_class_genocide(void) "declined to perform class genocide"); return; } + /* "?" runs #genocided to show existing genocides, then re-prompts; + accept "'?'" too because the prompt's hint shows it that way */ + if (!strcmp(buf, "?") || !strcmp(buf, "'?'")) { + list_genocided('g', FALSE); + --j; /* don't count this iteration as one of the tries */ + continue; + } class = name_to_monclass(buf, (int *) 0); if (class == 0 && (i = name_to_mon(buf, (int *) 0)) != NON_PM) @@ -2705,8 +2715,12 @@ do_genocide( return; } Strcpy(promptbuf, "What type of monster do you want to genocide?"); - if (iflags.cmdassist && i > 0) - Strcat(promptbuf, " [enter the name of a type of monster]"); + if (i > 0) + Snprintf(eos(promptbuf), sizeof promptbuf - strlen(promptbuf), + " [enter %s]", + iflags.cmdassist + ? "the name of a type of monster, or '?'" + : "'?' to see previous genocides"); getlin(promptbuf, buf); (void) mungspaces(buf); /* avoid 'such creatures do not exist' for empty input */ @@ -2728,6 +2742,12 @@ do_genocide( livelog_printf(LL_GENOCIDE, "declined to perform genocide"); return; } + /* "?" or "'?'" runs #genocided to show existing genocides */ + if (!strcmp(buf, "?") || !strcmp(buf, "'?'")) { + list_genocided('g', FALSE); + --i; /* don't count this iteration as one of the tries */ + continue; + } mndx = name_to_mon(buf, (int *) 0); if (mndx == NON_PM || (gm.mvitals[mndx].mvflags & G_GENOD)) {