-/* $NetBSD: shapes.c,v 1.4 1999/09/08 21:18:01 jsm Exp $ */
+/* $NetBSD: shapes.c,v 1.9 2014/06/11 16:47:39 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
* 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 BR B_COLS+1 /* bottom right */
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 */
+ /* 0*/ { 7, 7, { TL, TC, MR, } },
+ /* 1*/ { 1, 8, { TC, TR, ML, } },
+ /* 2*/ { 2, 9, { ML, MR, BC, } },
+ /* 3*/ { 3, 3, { TL, TC, ML, } },
+ /* 4*/ { 4, 12, { ML, BL, MR, } },
+ /* 5*/ { 5, 15, { ML, BR, MR, } },
+ /* 6*/ { 6, 18, { ML, MR, 2 } }, /* sticks out */
+ /* 7*/ { 7, 0, { TC, ML, BL, } },
+ /* 8*/ { 1, 1, { TC, MR, BR, } },
+ /* 9*/ { 2, 10, { TC, MR, BC, } },
+ /*10*/ { 2, 11, { TC, ML, MR, } },
+ /*11*/ { 2, 2, { TC, ML, BC, } },
+ /*12*/ { 4, 13, { TC, BC, BR, } },
+ /*13*/ { 4, 14, { TR, ML, MR, } },
+ /*14*/ { 4, 4, { TL, TC, BC, } },
+ /*15*/ { 5, 16, { TR, TC, BC, } },
+ /*16*/ { 5, 17, { TL, MR, ML, } },
+ /*17*/ { 5, 5, { TC, BC, BL, } },
+ /*18*/ { 6, 6, { TC, BC, 2*B_COLS } } /* sticks out */
};
/*
* taking the current board into account.
*/
int
-fits_in(shape, pos)
- const struct shape *shape;
- register int pos;
+fits_in(const struct shape *shape, int pos)
{
- register int *o = shape->off;
+ const int *o = shape->off;
if (board[pos] || board[pos + *o++] || board[pos + *o++] ||
board[pos + *o])
* if `onoff' is 1, and off if `onoff' is 0.
*/
void
-place(shape, pos, onoff)
- const struct shape *shape;
- register int pos, onoff;
+place(const struct shape *shape, int pos, int onoff)
{
- register int *o = shape->off;
+ const int *o = shape->off;
+ onoff = onoff ? shape->color : 0;
board[pos] = onoff;
board[pos + *o++] = onoff;