+/* $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
* 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.
*
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char sccsid[] = "@(#)init.c 5.4 (Berkeley) 6/1/90";
+#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++) {
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;
}
}
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];
Topcard = &Deck[DECK_SZ];
}
-newboard() {
-
- register int i;
- register PLAY *pp;
+void
+newboard(void)
+{
+ int i;
+ PLAY *pp;
static int first = TRUE;
if (first) {
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;
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;
for (i = 0; i < SCORE_Y; i++)
mvaddch(i, 0, '|');
move(SCORE_Y - 1, 1);
- while (addch('_') != ERR)
- continue;
+ for (i = 0; i < SCORE_X; i++)
+ addch('_');
for (pp = Player; pp <= &Player[COMP]; pp++) {
pp->sh_hand_tot = -1;
pp->sh_total = -1;