X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/28b5987d5dbdcb396c07b937a638590e5361361e..2964478b2dafe4131944bf92a975e8f07fb10a21:/mines.c diff --git a/mines.c b/mines.c index 7597d07..e888224 100644 --- a/mines.c +++ b/mines.c @@ -2604,27 +2604,23 @@ static game_state *execute_move(game_state *from, char *move) * Drawing routines. */ -static void game_size(game_params *params, game_drawstate *ds, - int *x, int *y, int expand) +static void game_compute_size(game_params *params, int tilesize, + int *x, int *y) { - double tsx, tsy, ts; - /* - * Each window dimension equals the tile size times 3 more than - * the grid dimension (the border is 3/2 the width of the - * tiles). - */ - tsx = (double)*x / ((double)params->w + 3.0); - tsy = (double)*y / ((double)params->h + 3.0); - ts = min(tsx, tsy); - if (expand) - ds->tilesize = (int)(ts + 0.5); - else - ds->tilesize = min((int)ts, PREFERRED_TILE_SIZE); + /* Ick: fake up `ds->tilesize' for macro expansion purposes */ + struct { int tilesize; } ads, *ds = &ads; + ads.tilesize = tilesize; *x = BORDER * 2 + TILE_SIZE * params->w; *y = BORDER * 2 + TILE_SIZE * params->h; } +static void game_set_size(game_drawstate *ds, game_params *params, + int tilesize) +{ + ds->tilesize = tilesize; +} + static float *game_colours(frontend *fe, game_state *state, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -3048,7 +3044,7 @@ const struct game thegame = { game_changed_state, interpret_move, execute_move, - game_size, + PREFERRED_TILE_SIZE, game_compute_size, game_set_size, game_colours, game_new_drawstate, game_free_drawstate,