X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/e926d53eabd7ef836ef12cdf1ee1437379a8f8d8..4fa17c6f9afc7c76d0350d5d9e5996391aa18137:/mille/init.c diff --git a/mille/init.c b/mille/init.c index 0dc7194d..6d6d5147 100644 --- a/mille/init.c +++ b/mille/init.c @@ -1,6 +1,8 @@ +/* $NetBSD: init.c,v 1.11 2009/05/25 23:34:50 dholland Exp $ */ + /* - * Copyright (c) 1982 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1982, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,24 +29,29 @@ * SUCH DAMAGE. */ +#include #ifndef lint -/*static char sccsid[] = "from: @(#)init.c 5.4 (Berkeley) 6/1/90";*/ -static char rcsid[] = "$Id: init.c,v 1.3 1994/01/13 01:19:58 mycroft Exp $"; +#if 0 +static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: init.c,v 1.11 2009/05/25 23:34:50 dholland Exp $"); +#endif #endif /* not lint */ -# include "mille.h" +#include "mille.h" /* * @(#)init.c 1.1 (Berkeley) 4/1/82 */ -init() { - - reg PLAY *pp; - reg int i, j; - reg CARD card; +void +init(void) +{ + PLAY *pp; + int i, j; + CARD card; - bzero(Numseen, sizeof Numseen); + memset(Numseen, 0, sizeof Numseen); Numgos = 0; for (i = 0; i < 2; i++) { @@ -62,7 +65,7 @@ init() { pp->hand[j] = *--Topcard; if (i == COMP) { account(card = *Topcard); - if (issafety(card)) + if (is_safety(card)) pp->safety[card - S_CONV] = S_IN_HAND; } } @@ -85,16 +88,17 @@ init() { End = 700; } -shuffle() { - - reg int i, r; - reg CARD temp; +void +shuffle(void) +{ + int i, r; + CARD temp; for (i = 0; i < DECK_SZ; i++) { r = roll(1, DECK_SZ) - 1; if (r < 0 || r > DECK_SZ - 1) { - fprintf(stderr, "shuffle: card no. error: %d\n", r); - die(); + warnx("shuffle: card no. error: %d", r); + die(1); } temp = Deck[r]; Deck[r] = Deck[i]; @@ -103,10 +107,11 @@ shuffle() { Topcard = &Deck[DECK_SZ]; } -newboard() { - - register int i; - register PLAY *pp; +void +newboard(void) +{ + int i; + PLAY *pp; static int first = TRUE; if (first) { @@ -161,10 +166,11 @@ newboard() { newscore(); } -newscore() { - - reg int i, new; - register PLAY *pp; +void +newscore(void) +{ + int i, new; + PLAY *pp; static int was_full = -1; static int last_win = -1; @@ -185,8 +191,7 @@ newscore() { mvaddstr(4, 37, "300"); new = TRUE; } - else if (((Window == W_FULL || Finished) ^ was_full) || - pp->was_finished != Finished) { + else if ((Window == W_FULL || Finished) ^ was_full) { move(5, 1); clrtobot(); new = TRUE; @@ -197,7 +202,7 @@ newscore() { for (i = 0; i < SCORE_Y; i++) mvaddch(i, 0, '|'); move(SCORE_Y - 1, 1); - for (i = 0; i < SCORE_X - 1; i++) + for (i = 0; i < SCORE_X; i++) addch('_'); for (pp = Player; pp <= &Player[COMP]; pp++) { pp->sh_hand_tot = -1;