diff options
Diffstat (limited to 'source/y/bsd-games/patches/0009-hangman-Error-out-on-1000-unsuitable-words.-Closes-6.patch')
-rw-r--r-- | source/y/bsd-games/patches/0009-hangman-Error-out-on-1000-unsuitable-words.-Closes-6.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/source/y/bsd-games/patches/0009-hangman-Error-out-on-1000-unsuitable-words.-Closes-6.patch b/source/y/bsd-games/patches/0009-hangman-Error-out-on-1000-unsuitable-words.-Closes-6.patch new file mode 100644 index 00000000..b55d7132 --- /dev/null +++ b/source/y/bsd-games/patches/0009-hangman-Error-out-on-1000-unsuitable-words.-Closes-6.patch @@ -0,0 +1,46 @@ +From: Peter Pentchev <roam@ringlet.net> +Date: Thu, 16 Feb 2012 22:37:50 +0100 +Subject: hangman: Error out on 1000 unsuitable words. Closes: #610270 + +--- + hangman/getword.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/hangman/getword.c b/hangman/getword.c +index 1b5396a..dc42a53 100644 +--- a/hangman/getword.c ++++ b/hangman/getword.c +@@ -50,8 +50,10 @@ getword() + FILE *inf; + char *wp, *gp; + long pos; ++ int tries; + + inf = Dict; ++ tries = 0; + for (;;) { + pos = (double) rand() / (RAND_MAX + 1.0) * (double) Dict_size; + fseek(inf, pos, SEEK_SET); +@@ -66,7 +68,21 @@ getword() + if (!islower((unsigned char)*wp)) + goto cont; + break; +-cont: ; ++cont: ++ if (++tries >= 1000) { ++ move(MESGY, MESGX); ++ deleteln(); ++ deleteln(); ++ deleteln(); ++ move(MESGY, MESGX); ++ printw("No suitable word found, try using " ++ "another dictionary!"); ++ leaveok(stdscr, FALSE); ++ refresh(); ++ readch(); ++ leaveok(stdscr, TRUE); ++ die(0); ++ } + } + gp = Known; + wp = Word; |