diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-04-20 22:54:57 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-04-20 22:54:57 +0000 |
commit | e63f1d5088d7ff97df87e8b0d0f1f11d7ed281ab (patch) | |
tree | 776a0bdd3843af58fb8f541710be163596d07740 | |
parent | 8a82c5710a0fb068690fde9036223f53b6b5435a (diff) |
Don't allow guessed letters to wrap; closes PR800. Based on fix from
krw@tcn.net. Also, check to make sure the screen is big enough.
-rw-r--r-- | games/hangman/hangman.h | 9 | ||||
-rw-r--r-- | games/hangman/main.c | 8 | ||||
-rw-r--r-- | games/hangman/setup.c | 5 |
3 files changed, 13 insertions, 9 deletions
diff --git a/games/hangman/hangman.h b/games/hangman/hangman.h index 22b054653eb..5bf38a6f2fb 100644 --- a/games/hangman/hangman.h +++ b/games/hangman/hangman.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hangman.h,v 1.2 1998/08/19 07:40:36 pjanzen Exp $ */ +/* $OpenBSD: hangman.h,v 1.3 1999/04/20 22:54:55 pjanzen Exp $ */ /* $NetBSD: hangman.h,v 1.5 1995/04/24 12:23:44 cgd Exp $ */ /* @@ -40,6 +40,7 @@ #include <sys/stat.h> #include <ctype.h> #include <curses.h> +#include <err.h> #include <signal.h> #include <stdlib.h> #include <string.h> @@ -56,11 +57,11 @@ #define KNOWNY 10 #define KNOWNX 1 #define NUMBERY 4 -#define NUMBERX (COLS - 1 - 26) +#define NUMBERX (COLS - 11 - 26) #define AVGY 5 -#define AVGX (COLS - 1 - 26) +#define AVGX (COLS - 11 - 26) #define GUESSY 2 -#define GUESSX (COLS - 1 - 26) +#define GUESSX (COLS - 11 - 26) typedef struct { diff --git a/games/hangman/main.c b/games/hangman/main.c index 03c6a356746..417a90f8147 100644 --- a/games/hangman/main.c +++ b/games/hangman/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.4 1998/08/19 07:40:37 pjanzen Exp $ */ +/* $OpenBSD: main.c,v 1.5 1999/04/20 22:54:56 pjanzen Exp $ */ /* $NetBSD: main.c,v 1.3 1995/03/23 08:32:50 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.4 1998/08/19 07:40:37 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.5 1999/04/20 22:54:56 pjanzen Exp $"; #endif #endif /* not lint */ @@ -63,6 +63,10 @@ main(argc, argv) setgid(getgid()); initscr(); + if (COLS < 50 || LINES < 14) { + endwin(); + errx(1, "screen too small (must be at least 50x14)"); + } signal(SIGINT, die); setup(); for (;;) { diff --git a/games/hangman/setup.c b/games/hangman/setup.c index 03730d4c02b..c431273a4b4 100644 --- a/games/hangman/setup.c +++ b/games/hangman/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.2 1998/08/19 07:40:45 pjanzen Exp $ */ +/* $OpenBSD: setup.c,v 1.3 1999/04/20 22:54:56 pjanzen Exp $ */ /* $NetBSD: setup.c,v 1.3 1995/03/23 08:32:59 cgd Exp $ */ /*- @@ -38,11 +38,10 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: setup.c,v 1.2 1998/08/19 07:40:45 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: setup.c,v 1.3 1999/04/20 22:54:56 pjanzen Exp $"; #endif #endif /* not lint */ -#include <err.h> #include "hangman.h" /* |