X-Git-Url: https://git.draconx.ca/gitweb/rrace.git/blobdiff_plain/a3f2189bfac7e5b1acdf3640cd3b50a7a6636906..26fb4b6902a32be6e9f504bee44724a0dd4292f7:/src/game.c diff --git a/src/game.c b/src/game.c index ca03830..f7cc2bb 100644 --- a/src/game.c +++ b/src/game.c @@ -134,34 +134,28 @@ void game_reset(struct board *board) memset(board->goal, 0, sizeof board->goal); for (i = 0; i < 9; i++) { - uint_fast32_t position = board_position(i/3+1, i%3+1); - - if (tiles[i] & 1) - board->goal[0] |= position >> 6; - if (tiles[i] & 2) - board->goal[1] |= position >> 6; - if (tiles[i] & 4) - board->goal[2] |= position >> 6; + uint_fast32_t position = board_position(i/3+1, i%3+1) >> 6; + + if (tiles[i] & 1) board->goal[0] |= position; + if (tiles[i] & 2) board->goal[1] |= position; + if (tiles[i] & 4) board->goal[2] |= position; } tiles[24] = TILE_EMPTY; shuffle(tiles, 25); - memset(board->game, 0, sizeof board->game); + memset(board->game, 0, sizeof board->game); for (i = 0; i < 25; i++) { unsigned x = i/5, y = i%5; uint_fast32_t position; position = board_position(x, y); if (tiles[i] != TILE_EMPTY) { - if (tiles[i] & 1) - board->game[0] |= position; - if (tiles[i] & 2) - board->game[1] |= position; - if (tiles[i] & 4) - board->game[2] |= position; + if (tiles[i] & 1) board->game[0] |= position; + if (tiles[i] & 2) board->game[1] |= position; + if (tiles[i] & 4) board->game[2] |= position; } else { - board->game[3] = 0x1ffffff ^ position; + board->game[3] = ~position; board->x = x; board->y = y; } @@ -197,8 +191,6 @@ int game_do_move(struct board *board, int x, int y) return 0; } -#define GOAL_MASK 0x739c0 - int game_check_goal(struct board *board) { int i, ret = 1;