X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/5ff78ede5ea1a80c654d3f0684cd5f36d5253ae1..68d82673282bfd2baa3f9533c92be6121d346cd9:/atc/graphics.c diff --git a/atc/graphics.c b/atc/graphics.c index 75df3925..eb34c23d 100644 --- a/atc/graphics.c +++ b/atc/graphics.c @@ -1,4 +1,4 @@ -/* $NetBSD: graphics.c,v 1.3 1995/03/21 15:04:04 cgd Exp $ */ +/* $NetBSD: graphics.c,v 1.10 2003/08/07 09:36:54 agc Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -15,11 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -45,18 +41,16 @@ * For more info on this and all of my stuff, mail edjames@berkeley.edu. */ +#include #ifndef lint #if 0 static char sccsid[] = "@(#)graphics.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: graphics.c,v 1.3 1995/03/21 15:04:04 cgd Exp $"; +__RCSID("$NetBSD: graphics.c,v 1.10 2003/08/07 09:36:54 agc Exp $"); #endif #endif /* not lint */ #include "include.h" -#ifdef SYSV -#include -#endif #define C_TOPBOTTOM '-' #define C_LEFTRIGHT '|' @@ -68,19 +62,20 @@ static char rcsid[] = "$NetBSD: graphics.c,v 1.3 1995/03/21 15:04:04 cgd Exp $"; WINDOW *radar, *cleanradar, *credit, *input, *planes; +int getAChar() { -#ifdef BSD - return (getchar()); -#endif -#ifdef SYSV int c; - while ((c = getchar()) == -1 && errno == EINTR) ; + errno = 0; + while ((c = getchar()) == EOF && errno == EINTR) { + errno = 0; + clearerr(stdin); + } return(c); -#endif } +void erase_all() { PLANE *pp; @@ -95,6 +90,7 @@ erase_all() } } +void draw_all() { PLANE *pp; @@ -114,6 +110,7 @@ draw_all() fflush(stdout); } +void init_gr() { static char buffer[BUFSIZ]; @@ -126,11 +123,13 @@ init_gr() planes = newwin(LINES - INPUT_LINES, PLANE_COLS, 0, COLS - PLANE_COLS); } +void setup_screen(scp) - C_SCREEN *scp; + const C_SCREEN *scp; { - register int i, j; - char str[3], *airstr; + int i, j; + char str[3]; + const char *airstr; str[2] = '\0'; @@ -217,9 +216,11 @@ setup_screen(scp) fflush(stdout); } +void draw_line(w, x, y, lx, ly, s) WINDOW *w; - char *s; + int x, y, lx, ly; + const char *s; { int dx, dy; @@ -235,7 +236,9 @@ draw_line(w, x, y, lx, ly, s) } } +void ioclrtoeol(pos) + int pos; { wmove(input, 0, pos); wclrtoeol(input); @@ -243,15 +246,19 @@ ioclrtoeol(pos) fflush(stdout); } +void iomove(pos) + int pos; { wmove(input, 0, pos); wrefresh(input); fflush(stdout); } +void ioaddstr(pos, str) - char *str; + int pos; + const char *str; { wmove(input, 0, pos); waddstr(input, str); @@ -259,6 +266,7 @@ ioaddstr(pos, str) fflush(stdout); } +void ioclrtobot() { wclrtobot(input); @@ -266,8 +274,10 @@ ioclrtobot() fflush(stdout); } +void ioerror(pos, len, str) - char *str; + int pos, len; + const char *str; { int i; @@ -280,7 +290,9 @@ ioerror(pos, len, str) fflush(stdout); } -quit() +void +quit(dummy) + int dummy __attribute__((__unused__)); { int c, y, x; #ifdef BSD @@ -317,13 +329,12 @@ quit() wmove(input, y, x); wrefresh(input); fflush(stdout); - return; } +void planewin() { PLANE *pp; - char *command(); int warning = 0; #ifdef BSD @@ -363,9 +374,10 @@ planewin() fflush(stdout); } +void loser(p, s) - PLANE *p; - char *s; + const PLANE *p; + const char *s; { int c; #ifdef BSD @@ -384,8 +396,12 @@ loser(p, s) wmove(input, 0, 0); wclrtobot(input); - wprintw(input, "Plane '%c' %s\n\nHit space for top players list...", - name(p), s); + /* p may be NULL if we ran out of memory */ + if (p == NULL) + wprintw(input, "%s\n\nHit space for top players list...", s); + else + wprintw(input, "Plane '%c' %s\n\nHit space for top players list...", + name(p), s); wrefresh(input); fflush(stdout); while ((c = getchar()) != EOF && c != ' ') @@ -397,6 +413,7 @@ loser(p, s) exit(0); } +void redraw() { clear(); @@ -415,7 +432,7 @@ redraw() fflush(stdout); } - +void done_screen() { clear();