--- bs.c~ Fri Apr 6 14:08:44 2001 +++ bs.c Fri Apr 6 14:08:44 2001 @@ -311,13 +311,11 @@ static void randomplace(int b, ship_t *ss) /* generate a valid random ship placement into px,py */ { - register int bwidth = BWIDTH - ss->length; - register int bdepth = BDEPTH - ss->length; do { - ss->y = rnd(bdepth); - ss->x = rnd(bwidth); ss->dir = rnd(2) ? E : S; + ss->y = rnd(BWIDTH - (ss->dir == E ? ss->length : 0)); + ss->x = rnd(BDEPTH - (ss->dir == S ? ss->length : 0)); } while (!checkplace(b, ss, FALSE)); } @@ -675,8 +673,8 @@ int l, xend, yend; /* first, check for board edges */ - xend = ss->x + ss->length * xincr[ss->dir]; - yend = ss->y + ss->length * yincr[ss->dir]; + xend = ss->x + (ss->length - 1) * xincr[ss->dir]; + yend = ss->y + (ss->length - 1) * yincr[ss->dir]; if (!ONBOARD(xend, yend)) { if (vis) @@ -782,6 +780,11 @@ attrset(0); #endif /* A_COLOR */ } + else + { + pgoto(y1, x1); + (void)addch(SHOWSPLASH); + } } } } @@ -796,6 +799,18 @@ { cgoto(y1, x1); (void) addch((chtype)(ss->symbol)); + } + else + { + pgoto(y1, x1); +#ifdef A_COLOR + if (has_colors()) + attron(COLOR_PAIR(COLOR_RED)); +#endif /* A_COLOR */ + (void)addch(SHOWHIT); +#ifdef A_COLOR + attrset(0); +#endif /* A_COLOR */ } }