From fc7a2a9869624cd234acfc73a62470508cd67cc0 Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Tue, 27 Sep 2022 20:47:57 -0400 Subject: [PATCH 1/2] Don't screen out empty input in class genocide So that a blank line wouldn't use up one of the player's "tries" for class genocide, the game would continue to prompt until the input was non-blank (or the user hit ), with a tight loop around the getlin call that only exited when it got some non-empty input. This apparently risked leaving the game endlessly looping under some worst-case-scenario hangup conditions. It was also inconsistent with normal genocide, which doesn't have special handling of blank lines. Make the class genocide prompt behave like the normal genocide prompt by removing the "blank input" loop (and consequently treating a blank line the same way as any other attempt to write a name). --- src/read.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/read.c b/src/read.c index 4e4d2f0cc..0d7bb5115 100644 --- a/src/read.c +++ b/src/read.c @@ -2471,10 +2471,8 @@ do_class_genocide(void) pline1(thats_enough_tries); return; } - do { - getlin("What class of monsters do you wish to genocide?", buf); - (void) mungspaces(buf); - } while (!*buf); + getlin("What class of monsters do you wish to genocide?", buf); + (void) mungspaces(buf); /* choosing "none" preserves genocideless conduct */ if (*buf == '\033' || !strcmpi(buf, "none") || !strcmpi(buf, "nothing")) { From 365d728be7a760c30aa34083e2d3eeaaffeb7882 Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Tue, 27 Sep 2022 21:08:30 -0400 Subject: [PATCH 2/2] Show genocide prompt help iff 'cmdassist' enabled The "[type the name]" prompt seems appropriate for handling via cmdassist, so experienced players who don't need the help can hide it. I also added a corresponding help note for the class genocide prompt. --- src/read.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/read.c b/src/read.c index 0d7bb5115..5f9a23641 100644 --- a/src/read.c +++ b/src/read.c @@ -2463,7 +2463,7 @@ do_class_genocide(void) { int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0; int ll_done = 0; - char buf[BUFSZ] = DUMMY; + char buf[BUFSZ] = DUMMY, promptbuf[QBUFSZ]; boolean gameover = FALSE; /* true iff killed self */ for (j = 0;; j++) { @@ -2471,7 +2471,10 @@ do_class_genocide(void) pline1(thats_enough_tries); return; } - getlin("What class of monsters do you wish to genocide?", buf); + Strcpy(promptbuf, "What class of monsters do you want to genocide?"); + if (iflags.cmdassist && j > 0) + Strcat(promptbuf, " [type the symbol representing a class]"); + getlin(promptbuf, buf); (void) mungspaces(buf); /* choosing "none" preserves genocideless conduct */ if (*buf == '\033' || !strcmpi(buf, "none") @@ -2629,7 +2632,7 @@ do_genocide(int how) /* 3 = forced genocide of player */ /* 5 (4 | 1) = normal genocide from throne */ { - char buf[BUFSZ] = DUMMY; + char buf[BUFSZ] = DUMMY, promptbuf[QBUFSZ]; register int i, killplayer = 0; register int mndx; register struct permonst *ptr; @@ -2650,8 +2653,10 @@ do_genocide(int how) pline1(thats_enough_tries); return; } - getlin("What monster do you want to genocide? [type the name]", - buf); + Strcpy(promptbuf, "What monster do you want to genocide?"); + if (iflags.cmdassist && i > 0) + Strcat(promptbuf, " [type the name of a monster]"); + getlin(promptbuf, buf); (void) mungspaces(buf); /* choosing "none" preserves genocideless conduct */ if (*buf == '\033' || !strcmpi(buf, "none")