+/* $NetBSD: graphics.c,v 1.10 2003/08/07 09:36:54 agc Exp $ */
+
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ed James.
* 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.
*
* For more info on this and all of my stuff, mail edjames@berkeley.edu.
*/
+#include <sys/cdefs.h>
#ifndef lint
-/*static char sccsid[] = "from: @(#)graphics.c 5.3 (Berkeley) 10/30/90";*/
-static char rcsid[] = "$Id: graphics.c,v 1.2 1993/08/01 18:57:09 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)graphics.c 8.1 (Berkeley) 5/31/93";
+#else
+__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 <errno.h>
-#endif
#define C_TOPBOTTOM '-'
#define C_LEFTRIGHT '|'
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;
}
}
+void
draw_all()
{
PLANE *pp;
fflush(stdout);
}
+void
init_gr()
{
static char buffer[BUFSIZ];
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';
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;
}
}
+void
ioclrtoeol(pos)
+ int pos;
{
wmove(input, 0, pos);
wclrtoeol(input);
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);
fflush(stdout);
}
+void
ioclrtobot()
{
wclrtobot(input);
fflush(stdout);
}
+void
ioerror(pos, len, str)
- char *str;
+ int pos, len;
+ const char *str;
{
int i;
fflush(stdout);
}
-quit()
+void
+quit(dummy)
+ int dummy __attribute__((__unused__));
{
int c, y, x;
#ifdef BSD
wmove(input, y, x);
wrefresh(input);
fflush(stdout);
- return;
}
+void
planewin()
{
PLANE *pp;
- char *command();
int warning = 0;
#ifdef BSD
fflush(stdout);
}
+void
loser(p, s)
- PLANE *p;
- char *s;
+ const PLANE *p;
+ const char *s;
{
int c;
#ifdef BSD
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 != ' ')
exit(0);
}
+void
redraw()
{
clear();
fflush(stdout);
}
-
+void
done_screen()
{
clear();