-/* $NetBSD: fly.c,v 1.11 2003/08/07 09:37:02 agc Exp $ */
+/* $NetBSD: fly.c,v 1.15 2012/10/13 19:58:53 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)fly.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: fly.c,v 1.11 2003/08/07 09:37:02 agc Exp $");
+__RCSID("$NetBSD: fly.c,v 1.15 2012/10/13 19:58:53 dholland Exp $");
#endif
#endif /* not lint */
#include "extern.h"
#undef UP
#include <curses.h>
+#include <assert.h>
#define MIDR (LINES/2 - 1)
#define MIDC (COLS/2 - 1)
static char cross = 0;
static sig_t oldsig;
-static void blast __P((void));
-static void endfly __P((void));
-static void moveenemy __P((int));
-static void notarget __P((void));
-static void screen __P((void));
-static void succumb __P((int));
-static void target __P((void));
+static void blast(void);
+static void endfly(void);
+static void moveenemy(int);
+static void notarget(void);
+static void screen(void);
+static void succumb(int);
+static void target(void);
static void
-succumb(dummy)
- int dummy __attribute__((__unused__));
+succumb(int dummy __unused)
{
if (oldsig == SIG_DFL) {
endfly();
}
int
-visual()
+visual(void)
{
destroyed = 0;
if (initscr() == NULL) {
if (torps) {
torps -= 2;
blast();
- if (row == MIDR && column - MIDC < 2 && MIDC - column < 2) {
+ if (row == MIDR && column < MIDC + 2 &&
+ column > MIDC - 2) {
destroyed = 1;
alarm(0);
}
}
static void
-screen()
+screen(void)
{
int r, c, n;
int i;
}
static void
-target()
+target(void)
{
int n;
}
static void
-notarget()
+notarget(void)
{
int n;
}
static void
-blast()
+blast(void)
{
int n;
}
static void
-moveenemy(dummy)
- int dummy __attribute__((__unused__));
+moveenemy(int dummy __unused)
{
double d;
int oldr, oldc;
fuel = 0;
mvaddstr(0, 60, "*** Out of fuel ***");
}
- d = (double) ((row - MIDR) * (row - MIDR) + (column - MIDC) * (column - MIDC));
+ d = (double) ((row - MIDR) * (row - MIDR) + (column - MIDC) *
+ (column - MIDC));
if (d < 16) {
row += (rnd(9) - 4) % (4 - abs(row - MIDR));
column += (rnd(9) - 4) % (4 - abs(column - MIDC));
}
static void
-endfly()
+endfly(void)
{
alarm(0);
signal(SIGALRM, SIG_DFL);