]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - gomoku/bdinit.c
Remove remaining references to sprintf.
[bsdgames-darwin.git] / gomoku / bdinit.c
index f9219fdd8588210b2c9aad58eae74cd9d6722c08..93a58f49600b55fc01d7450c62be4718a005680e 100644 (file)
@@ -1,5 +1,5 @@
-/* $NetBSD: bdinit.c,v 1.2 1996/12/28 18:56:58 tls Exp $
-*/
+/*     $NetBSD: bdinit.c,v 1.7 2009/06/04 05:43:29 dholland Exp $      */
+
 /*
  * Copyright (c) 1994
  *     The Regents of the University of California.  All rights reserved.
  * 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
 #if 0
 static char sccsid[] = "from: @(#)bdinit.c     8.2 (Berkeley) 5/3/95";
 #else
-static char rcsid[] = "$NetBSD: bdinit.c,v 1.2 1996/12/28 18:56:58 tls Exp $";
+__RCSID("$NetBSD: bdinit.c,v 1.7 2009/06/04 05:43:29 dholland Exp $");
 #endif
 #endif /* not lint */
 
 #include <string.h>
 #include "gomoku.h"
 
-bdinit(bp)
-       struct spotstr *bp;
+void
+bdinit(struct spotstr *bp)
 {
-       register int i, j, r;
-       register struct spotstr *sp;
-       register struct combostr *cbp;
+       int i, j, r;
+       struct spotstr *sp;
+       struct combostr *cbp;
 
        movenum = 1;
 
@@ -60,7 +57,7 @@ bdinit(bp)
        sp = bp;
        for (i = BSZ2; --i >= 0; sp++) {
                sp->s_occ = BORDER;             /* top border */
-               sp->s_flg = BFLAGALL;
+               sp->s_flags = BFLAGALL;
        }
 
        /* fill entire board with EMPTY spots */
@@ -69,11 +66,11 @@ bdinit(bp)
        for (j = 0; ++j < BSZ1; sp++) {                 /* for each row */
                for (i = 0; ++i < BSZ1; sp++) {         /* for each column */
                        sp->s_occ = EMPTY;
-                       sp->s_flg = 0;
+                       sp->s_flags = 0;
                        sp->s_wval = 0;
                        if (j < 5) {
                                /* directions 1, 2, 3 are blocked */
-                               sp->s_flg |= (BFLAG << 1) | (BFLAG << 2) |
+                               sp->s_flags |= (BFLAG << 1) | (BFLAG << 2) |
                                        (BFLAG << 3);
                                sp->s_fval[BLACK][1].s = MAXCOMBO;
                                sp->s_fval[BLACK][2].s = MAXCOMBO;
@@ -100,7 +97,7 @@ bdinit(bp)
                        }
                        if (i > (BSZ - 4)) {
                                /* directions 0, 1 are blocked */
-                               sp->s_flg |= BFLAG | (BFLAG << 1);
+                               sp->s_flags |= BFLAG | (BFLAG << 1);
                                sp->s_fval[BLACK][0].s = MAXCOMBO;
                                sp->s_fval[BLACK][1].s = MAXCOMBO;
                                sp->s_fval[WHITE][0].s = MAXCOMBO;
@@ -109,7 +106,7 @@ bdinit(bp)
                                sp->s_fval[BLACK][0].s = 0x500;
                                sp->s_fval[WHITE][0].s = 0x500;
                                /* if direction 1 is not blocked */
-                               if (!(sp->s_flg & (BFLAG << 1))) {
+                               if (!(sp->s_flags & (BFLAG << 1))) {
                                        sp->s_fval[BLACK][1].s = 0x500;
                                        sp->s_fval[WHITE][1].s = 0x500;
                                }
@@ -118,11 +115,11 @@ bdinit(bp)
                                sp->s_fval[WHITE][0].s = 0x401;
                                if (i < 5) {
                                        /* direction 3 is blocked */
-                                       sp->s_flg |= (BFLAG << 3);
+                                       sp->s_flags |= (BFLAG << 3);
                                        sp->s_fval[BLACK][3].s = MAXCOMBO;
                                        sp->s_fval[WHITE][3].s = MAXCOMBO;
                                } else if (i == 5 &&
-                                   !(sp->s_flg & (BFLAG << 3))) {
+                                   !(sp->s_flags & (BFLAG << 3))) {
                                        sp->s_fval[BLACK][3].s = 0x500;
                                        sp->s_fval[WHITE][3].s = 0x500;
                                }
@@ -131,7 +128,7 @@ bdinit(bp)
                         * Allocate a frame structure for non blocked frames.
                         */
                        for (r = 4; --r >= 0; ) {
-                               if (sp->s_flg & (BFLAG << r))
+                               if (sp->s_flags & (BFLAG << r))
                                        continue;
                                cbp->c_combo.s = sp->s_fval[BLACK][r].s;
                                cbp->c_vertex = sp - board;
@@ -142,13 +139,13 @@ bdinit(bp)
                        }
                }
                sp->s_occ = BORDER;             /* left & right border */
-               sp->s_flg = BFLAGALL;
+               sp->s_flags = BFLAGALL;
        }
 
        /* mark the borders as such */
        for (i = BSZ1; --i >= 0; sp++) {
                sp->s_occ = BORDER;             /* bottom border */
-               sp->s_flg = BFLAGALL;
+               sp->s_flags = BFLAGALL;
        }
 
        sortframes[BLACK] = (struct combostr *)0;
@@ -173,11 +170,12 @@ bdinit(bp)
  * As pieces are played, it can make frames not overlap if there are no
  * common open spaces shared between the two frames.
  */
-init_overlap()
+void
+init_overlap(void)
 {
-       register struct spotstr *sp1, *sp2;
-       register struct combostr *cbp;
-       register int i, f, r, n, d1, d2;
+       struct spotstr *sp1, *sp2;
+       struct combostr *cbp;
+       int i, f, r, n, d1, d2;
        int mask, bmask, vertex, s;
        u_char *str;
        short *ip;
@@ -209,7 +207,7 @@ init_overlap()
                    for (f = 0; f < 6; f++, sp2 -= d2) {
                        if (sp2->s_occ == BORDER)
                            break;
-                       if (sp2->s_flg & bmask)
+                       if (sp2->s_flags & bmask)
                            continue;
                        n = sp2->s_frame[r] - frames;
                        ip[n] = vertex;