/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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.46 2008/07/05 20:56:25 tom Exp $
+ * $Id: bs.c,v 1.49 2009/10/10 16:01:41 tom Exp $
*/
#include <test.priv.h>
if ((tmpname = getlogin()) != 0) {
(void) strcpy(name, tmpname);
- name[0] = toupper(UChar(name[0]));
+ name[0] = (char) toupper(UChar(name[0]));
} else
(void) strcpy(name, dftname);
for (j = 0; j < BWIDTH; j++)
(void) addstr(" . ");
#ifdef A_COLOR
- attrset(0);
+ (void) attrset(0);
#endif /* A_COLOR */
(void) addch(' ');
(void) addch((chtype) (i + 'A'));
for (j = 0; j < BWIDTH; j++)
(void) addstr(" . ");
#ifdef A_COLOR
- attrset(0);
+ (void) attrset(0);
#endif /* A_COLOR */
(void) addch(' ');
(void) addch((chtype) (i + 'A'));
/* get a command letter */
prompt(1, "Type one of [%s] to pick a ship.", docked + 1);
do {
- c = getcoord(PLAYER);
+ c = (char) getcoord(PLAYER);
} while
(!strchr(docked, c));
}
do {
- c = getch();
+ c = (char) getch();
} while
(!(strchr("hjklrR", c) || c == FF));
(void) clearok(stdscr, TRUE);
(void) refresh();
} else if (c == 'r') {
+ assert(ss != 0);
prompt(1, "Random-placing your %s", ss->name);
randomplace(PLAYER, ss);
placeship(PLAYER, ss, TRUE);
}
error((char *) NULL);
} else if (strchr("hjkl8462", c)) {
+ assert(ss != 0);
ss->x = curx;
ss->y = cury;
#endif /* A_COLOR */
(void) addch(MARK_MISS);
#ifdef A_COLOR
- attrset(0);
+ (void) attrset(0);
#endif /* A_COLOR */
} else {
pgoto(y1, x1);
#endif /* A_COLOR */
(void) addch(SHOWHIT);
#ifdef A_COLOR
- attrset(0);
+ (void) attrset(0);
#endif /* A_COLOR */
}
}
break;
}
hit = IS_SHIP(board[COMPUTER][curx][cury]);
- hits[PLAYER][curx][cury] = (hit ? MARK_HIT : MARK_MISS);
+ hits[PLAYER][curx][cury] = (char) (hit ? MARK_HIT : MARK_MISS);
cgoto(cury, curx);
#ifdef A_COLOR
if (has_colors()) {
#endif /* A_COLOR */
(void) addch((chtype) hits[PLAYER][curx][cury]);
#ifdef A_COLOR
- attrset(0);
+ (void) attrset(0);
#endif /* A_COLOR */
prompt(1, "You %s.", hit ? "scored a hit" : "missed");
bool hit, sunk;
ship_t *ss = NULL;
- hits[COMPUTER][x][y] = (hit = (board[PLAYER][x][y])) ? MARK_HIT : MARK_MISS;
+ hits[COMPUTER][x][y] = (char) (hit = (board[PLAYER][x][y])) ? MARK_HIT : MARK_MISS;
(void) mvprintw(PROMPTLINE, 0,
"I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" :
"miss");
#endif /* A_COLOR */
(void) addch((chtype) (hit ? SHOWHIT : SHOWSPLASH));
#ifdef A_COLOR
- attrset(0);
+ (void) attrset(0);
#endif /* A_COLOR */
return hit ? (sunk ? S_SUNK : S_HIT) : S_MISS;