-/* $NetBSD: fly.c,v 1.14 2007/12/15 19:44:39 perry Exp $ */
+/* $NetBSD: fly.c,v 1.16 2021/05/02 12:50:43 rillig 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.14 2007/12/15 19:44:39 perry Exp $");
+__RCSID("$NetBSD: fly.c,v 1.16 2021/05/02 12:50:43 rillig 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)
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);
}
fuel = 0;
mvaddstr(0, 60, "*** Out of fuel ***");
}
- d = (double) ((row - MIDR) * (row - MIDR) + (column - MIDC) *
+ d = (double) ((row - MIDR) * (row - MIDR) + (column - MIDC) *
(column - MIDC));
if (d < 16) {
row += (rnd(9) - 4) % (4 - abs(row - MIDR));