]> granicus.if.org Git - nethack/commitdiff
Don't screen out empty input in class genocide
authorMichael Meyer <me@entrez.cc>
Wed, 28 Sep 2022 00:47:57 +0000 (20:47 -0400)
committerPatR <rankin@nethack.org>
Wed, 28 Sep 2022 21:47:56 +0000 (14:47 -0700)
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 <esc>), 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

index 4e4d2f0cc580649daeaa31c9226465bdf8b5bf10..0d7bb5115b159a9349938090ba53403343c4d09b 100644 (file)
@@ -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")) {