/****************************************************************************
- * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* v2.0 featuring strict ANSI/POSIX conformance, November 1993.
* v2.1 with ncurses mouse support, September 1995
*
- * $Id: bs.c,v 1.73 2018/05/12 15:07:51 tom Exp $
+ * $Id: bs.c,v 1.74 2019/08/17 21:49:19 tom Exp $
*/
#include <test.priv.h>
static int
getcoord(int atcpu)
{
- int ny, nx, c;
-
if (atcpu)
cgoto(cury, curx);
else
pgoto(cury, curx);
(void) refresh();
+
for (;;) {
+ int ny, nx, c;
+
if (atcpu) {
MvPrintw(CYBASE + BDEPTH + 1, CXBASE + 11, "(%d, %c)",
curx, 'A' + cury);
awinna(void)
{
int i, j;
- ship_t *ss;
for (i = 0; i < 2; ++i) {
- ss = (i) ? cpuship : plyship;
+ ship_t *ss = (i) ? cpuship : plyship;
for (j = 0; j < SHIPTYPES; ++j, ++ss)
if (ss->length > ss->hits)
break;
if (++ss->hits < ss->length) /* still afloat? */
return ((ship_t *) NULL);
else { /* sunk! */
- int i, j;
+ int i;
+
+ if (!closepack) {
+ int j;
- if (!closepack)
for (j = -1; j <= 1; j++) {
int bx = ss->x + j * xincr[(ss->dir + 2) % dir_MAX];
int by = ss->y + j * yincr[(ss->dir + 2) % dir_MAX];
}
}
}
+ }
for (i = 0; i < ss->length; ++i) {
int x1 = ss->x + i * xincr[ss->dir];
static int
sgetc(const char *s)
{
- const char *s1;
- int ch;
-
(void) refresh();
+
for (;;) {
- ch = getch();
+ int ch = getch();
+ const char *s1;
+
if (islower(ch))
ch = toupper(ch);
if (is_QUIT(ch))
static void
do_options(int c, char *op[])
{
- register int i;
-
if (c > 1) {
+ int i;
+
for (i = 1; i < c; i++) {
switch (op[i][0]) {
default: