+/* $NetBSD: shapes.c,v 1.6 2003/08/07 09:37:48 agc Exp $ */
+
/*-
* Copyright (c) 1992, 1993
* 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.
*
#define BC B_COLS /* bottom center */
#define BR B_COLS+1 /* bottom right */
-struct shape shapes[] = {
- /* 0*/ 7, TL, TC, MR,
- /* 1*/ 8, TC, TR, ML,
- /* 2*/ 9, ML, MR, BC,
- /* 3*/ 3, TL, TC, ML,
- /* 4*/ 12, ML, BL, MR,
- /* 5*/ 15, ML, BR, MR,
- /* 6*/ 18, ML, MR, /* sticks out */ 2,
- /* 7*/ 0, TC, ML, BL,
- /* 8*/ 1, TC, MR, BR,
- /* 9*/ 10, TC, MR, BC,
- /*10*/ 11, TC, ML, MR,
- /*11*/ 2, TC, ML, BC,
- /*12*/ 13, TC, BC, BR,
- /*13*/ 14, TR, ML, MR,
- /*14*/ 4, TL, TC, BC,
- /*15*/ 16, TR, TC, BC,
- /*16*/ 17, TL, MR, ML,
- /*17*/ 5, TC, BC, BL,
- /*18*/ 6, TC, BC, /* sticks out */ 2*B_COLS,
+const struct shape shapes[] = {
+ /* 0*/ { 7, { TL, TC, MR, } },
+ /* 1*/ { 8, { TC, TR, ML, } },
+ /* 2*/ { 9, { ML, MR, BC, } },
+ /* 3*/ { 3, { TL, TC, ML, } },
+ /* 4*/ { 12, { ML, BL, MR, } },
+ /* 5*/ { 15, { ML, BR, MR, } },
+ /* 6*/ { 18, { ML, MR, 2 } }, /* sticks out */
+ /* 7*/ { 0, { TC, ML, BL, } },
+ /* 8*/ { 1, { TC, MR, BR, } },
+ /* 9*/ { 10, { TC, MR, BC, } },
+ /*10*/ { 11, { TC, ML, MR, } },
+ /*11*/ { 2, { TC, ML, BC, } },
+ /*12*/ { 13, { TC, BC, BR, } },
+ /*13*/ { 14, { TR, ML, MR, } },
+ /*14*/ { 4, { TL, TC, BC, } },
+ /*15*/ { 16, { TR, TC, BC, } },
+ /*16*/ { 17, { TL, MR, ML, } },
+ /*17*/ { 5, { TC, BC, BL, } },
+ /*18*/ { 6, { TC, BC, 2*B_COLS } } /* sticks out */
};
/*
*/
int
fits_in(shape, pos)
- struct shape *shape;
- register int pos;
+ const struct shape *shape;
+ int pos;
{
- register int *o = shape->off;
+ int *o = shape->off;
if (board[pos] || board[pos + *o++] || board[pos + *o++] ||
board[pos + *o])
*/
void
place(shape, pos, onoff)
- struct shape *shape;
- register int pos, onoff;
+ const struct shape *shape;
+ int pos, onoff;
{
- register int *o = shape->off;
+ int *o = shape->off;
board[pos] = onoff;
board[pos + *o++] = onoff;