Subversion Repositories HelenOS

Rev

Rev 4515 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4515 Rev 4680
Line 85... Line 85...
85
 * Return true iff the given shape fits in the given position,
85
 * Return true iff the given shape fits in the given position,
86
 * taking the current board into account.
86
 * taking the current board into account.
87
 */
87
 */
88
int fits_in(const struct shape *shape, int pos)
88
int fits_in(const struct shape *shape, int pos)
89
{
89
{
90
    int *o = shape->off;
90
    const int *o = shape->off;
91
   
91
   
92
    if ((board[pos]) || (board[pos + *o++]) || (board[pos + *o++]) ||
92
    if ((board[pos]) || (board[pos + *o++]) || (board[pos + *o++]) ||
93
        (board[pos + *o]))
93
        (board[pos + *o]))
94
        return 0;
94
        return 0;
95
   
95
   
Line 100... Line 100...
100
 * Write the given shape into the current board, turning it on
100
 * Write the given shape into the current board, turning it on
101
 * if `onoff' is 1, and off if `onoff' is 0.
101
 * if `onoff' is 1, and off if `onoff' is 0.
102
 */
102
 */
103
void place(const struct shape *shape, int pos, int onoff)
103
void place(const struct shape *shape, int pos, int onoff)
104
{
104
{
105
    int *o = shape->off;
105
    const int *o = shape->off;
106
   
106
   
107
    board[pos] = onoff ? shape->color : 0x000000;
107
    board[pos] = onoff ? shape->color : 0x000000;
108
    board[pos + *o++] = onoff ? shape->color : 0x000000;
108
    board[pos + *o++] = onoff ? shape->color : 0x000000;
109
    board[pos + *o++] = onoff ? shape->color : 0x000000;
109
    board[pos + *o++] = onoff ? shape->color : 0x000000;
110
    board[pos + *o] = onoff ? shape->color : 0x000000;
110
    board[pos + *o] = onoff ? shape->color : 0x000000;