X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fbs.c;h=368abcd8f28d8e24898345966a4d02c985271a0d;hp=eaa6f1aed99be1913ca328ebcf38fae4e7713e89;hb=0eb88fc5281804773e2a0c7a488a4452463535ce;hpb=661078ddbde3ce0f3b06e95642fbb9b5fef7dca1 diff --git a/test/bs.c b/test/bs.c index eaa6f1ae..368abcd8 100644 --- a/test/bs.c +++ b/test/bs.c @@ -7,7 +7,7 @@ * v2.0 featuring strict ANSI/POSIX conformance, November 1993. * v2.1 with ncurses mouse support, September 1995 * - * $Id: bs.c,v 1.22 1997/12/20 15:11:53 tom Exp $ + * $Id: bs.c,v 1.24 1999/08/21 23:14:38 tom Exp $ */ #include @@ -129,22 +129,24 @@ ship_t; static bool checkplace(int b, ship_t *ss, int vis); +#define SHIPIT(name, symbol, length) { name, 0, symbol, length, 0,0, 0, FALSE } + static ship_t plyship[SHIPTYPES] = { - { carrier, 0, 'A', 5}, - { battle, 0, 'B', 4}, - { destroy, 0, 'D', 3}, - { sub, 0, 'S', 3}, - { ptboat, 0, 'P', 2}, + SHIPIT(carrier, 'A', 5), + SHIPIT(battle, 'B', 4), + SHIPIT(destroy, 'D', 3), + SHIPIT(sub, 'S', 3), + SHIPIT(ptboat, 'P', 2), }; static ship_t cpuship[SHIPTYPES] = { - { carrier, 0, 'A', 5}, - { battle, 0, 'B', 4}, - { destroy, 0, 'D', 3}, - { sub, 0, 'S', 3}, - { ptboat, 0, 'P', 2}, + SHIPIT(carrier, 'A', 5), + SHIPIT(battle, 'B', 4), + SHIPIT(destroy, 'D', 3), + SHIPIT(sub, 'S', 3), + SHIPIT(ptboat, 'P', 2), }; /* "Hits" board, and main board. */ @@ -827,11 +829,12 @@ static int plyturn(void) hits[PLAYER][curx][cury] = (hit ? MARK_HIT : MARK_MISS); cgoto(cury, curx); #ifdef A_COLOR - if (has_colors()) + if (has_colors()) { if (hit) attron(COLOR_PAIR(COLOR_RED)); else attron(COLOR_PAIR(COLOR_GREEN)); + } #endif /* A_COLOR */ (void) addch((chtype)hits[PLAYER][curx][cury]); #ifdef A_COLOR @@ -965,11 +968,12 @@ static int cpufire(int x, int y) pgoto(y, x); #ifdef A_COLOR - if (has_colors()) + if (has_colors()) { if (hit) attron(COLOR_PAIR(COLOR_RED)); else attron(COLOR_PAIR(COLOR_GREEN)); + } #endif /* A_COLOR */ (void)addch((chtype)(hit ? SHOWHIT : SHOWSPLASH)); #ifdef A_COLOR