ret->n = 2;
ret->rowsonly = ret->orientable = FALSE;
ret->movetarget = 0;
- while (*string && isdigit(*string)) string++;
+ while (*string && isdigit((unsigned char)*string)) string++;
if (*string == 'x') {
string++;
ret->h = atoi(string);
- while (*string && isdigit(*string)) string++;
+ while (*string && isdigit((unsigned char)*string)) string++;
}
if (*string == 'n') {
string++;
ret->n = atoi(string);
- while (*string && isdigit(*string)) string++;
+ while (*string && isdigit((unsigned char)*string)) string++;
}
while (*string) {
if (*string == 'r') {
} else if (*string == 'm') {
string++;
ret->movetarget = atoi(string);
- while (string[1] && isdigit(string[1])) string++;
+ while (string[1] && isdigit((unsigned char)string[1])) string++;
}
string++;
}
return ret;
}
-static char *validate_params(game_params *params)
+static char *validate_params(game_params *params, int full)
{
if (params->n < 2)
return "Rotation radius must be at least two";
* 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 one more
- * than the grid dimension (the border is half the width of the
- * tiles).
- */
- tsx = (double)*x / ((double)params->w + 1.0);
- tsy = (double)*y / ((double)params->h + 1.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 = TILE_SIZE * params->w + 2 * BORDER;
*y = TILE_SIZE * params->h + 2 * BORDER;
}
+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);
int i;
- float max;
-
- frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]);
- /*
- * Drop the background colour so that the highlight is
- * noticeably brighter than it while still being under 1.
- */
- max = ret[COL_BACKGROUND*3];
- for (i = 1; i < 3; i++)
- if (ret[COL_BACKGROUND*3+i] > max)
- max = ret[COL_BACKGROUND*3+i];
- if (max * 1.2F > 1.0F) {
- for (i = 0; i < 3; i++)
- ret[COL_BACKGROUND*3+i] /= (max * 1.2F);
- }
+ game_mkhighlight(fe, ret, COL_BACKGROUND, COL_HIGHLIGHT, COL_LOWLIGHT);
for (i = 0; i < 3; i++) {
- ret[COL_HIGHLIGHT * 3 + i] = ret[COL_BACKGROUND * 3 + i] * 1.2F;
ret[COL_HIGHLIGHT_GENTLE * 3 + i] = ret[COL_BACKGROUND * 3 + i] * 1.1F;
- ret[COL_LOWLIGHT * 3 + i] = ret[COL_BACKGROUND * 3 + i] * 0.8F;
ret[COL_LOWLIGHT_GENTLE * 3 + i] = ret[COL_BACKGROUND * 3 + i] * 0.9F;
ret[COL_TEXT * 3 + i] = 0.0;
}
return TRUE;
}
-static int game_timing_state(game_state *state)
+static int game_timing_state(game_state *state, game_ui *ui)
{
return TRUE;
}
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,