static void free_game(game_state *);
/* generate a random valid board; uses validate_board. */
-void make_board(int *board, int w, int h, random_state *rs) {
+static void make_board(int *board, int w, int h, random_state *rs) {
int *dsf;
const unsigned int sz = w * h;
static game_state *execute_move(game_state *state, char *move)
{
game_state *new_state;
+ const int sz = state->shared->params.w * state->shared->params.h;
if (*move == 's') {
- const int sz = state->shared->params.w * state->shared->params.h;
int i = 0;
new_state = dup_game(state);
for (++move; i < sz; ++i) new_state->board[i] = move[i] - '0';
value = strtol(move, &endptr, 0);
if (endptr == move) return NULL;
if (*endptr != '\0') return NULL;
+ if (i < 0 || i >= sz || value < 0 || value > 9) return NULL;
new_state = dup_game(state);
new_state->board[i] = value;
}
* should start by drawing a big background-colour rectangle
* covering the whole window.
*/
- draw_rect(dr, 0, 0, 10*ds->tilesize, 10*ds->tilesize, COL_BACKGROUND);
+ draw_rect(dr, 0, 0, w*TILE_SIZE + 2*BORDER, h*TILE_SIZE + 2*BORDER,
+ COL_BACKGROUND);
/*
* Smaller black rectangle which is the main grid.
h*TILE_SIZE + 2*BORDER_WIDTH + 1,
COL_GRID);
+ draw_update(dr, 0, 0, w*TILE_SIZE + 2*BORDER, h*TILE_SIZE + 2*BORDER);
+
ds->started = TRUE;
}