diff options
| -rw-r--r-- | blackbox.c | 2 | ||||
| -rw-r--r-- | bridges.c | 2 | ||||
| -rw-r--r-- | cube.c | 2 | ||||
| -rw-r--r-- | devel.but | 12 | ||||
| -rw-r--r-- | dominosa.c | 2 | ||||
| -rw-r--r-- | fifteen.c | 2 | ||||
| -rw-r--r-- | flip.c | 2 | ||||
| -rw-r--r-- | guess.c | 2 | ||||
| -rw-r--r-- | inertia.c | 2 | ||||
| -rw-r--r-- | lightup.c | 2 | ||||
| -rw-r--r-- | loopy.c | 2 | ||||
| -rw-r--r-- | map.c | 2 | ||||
| -rw-r--r-- | midend.c | 16 | ||||
| -rw-r--r-- | mines.c | 2 | ||||
| -rw-r--r-- | net.c | 2 | ||||
| -rw-r--r-- | netslide.c | 2 | ||||
| -rw-r--r-- | nullgame.c | 2 | ||||
| -rw-r--r-- | pattern.c | 2 | ||||
| -rw-r--r-- | pegs.c | 2 | ||||
| -rw-r--r-- | puzzles.h | 2 | ||||
| -rw-r--r-- | rect.c | 2 | ||||
| -rw-r--r-- | samegame.c | 2 | ||||
| -rw-r--r-- | sixteen.c | 2 | ||||
| -rw-r--r-- | slant.c | 2 | ||||
| -rw-r--r-- | solo.c | 2 | ||||
| -rw-r--r-- | tents.c | 2 | ||||
| -rw-r--r-- | twiddle.c | 2 | ||||
| -rw-r--r-- | untangle.c | 2 |
28 files changed, 29 insertions, 51 deletions
@@ -1060,7 +1060,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->rrad = (3*tilesize)/8; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); int i; @@ -2230,7 +2230,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); int i; @@ -1476,7 +1476,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->oy = (int)(-(bb.u - solids[params->solid]->border) * ds->gridscale); } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -1104,7 +1104,7 @@ create a fresh drawstate. \S{backend-colours} \cw{colours()} -\c float *(*colours)(frontend *fe, game_state *state, int *ncolours); +\c float *(*colours)(frontend *fe, int *ncolours); This function is responsible for telling the front end what colours the puzzle will need to draw itself. @@ -1115,15 +1115,7 @@ array of three times that many \c{float}s, containing the red, green and blue components of each colour respectively as numbers in the range [0,1]. -It is passed a sample \c{game_state} in case it needs one, although -currently no puzzle does need this. (In fact, colours are not -reallocated when the game parameters change or a new game is -started, so you can't reliably use this \c{game_state} to allocate a -different number of colours depending on the game. It is probably -actually a mistake to rely on this parameter at all. I ought to -either remove it or fix it; probably the former.) - -The final parameter passed to this function is a front end handle. +The second parameter passed to this function is a front end handle. The only things it is permitted to do with this handle are to call the front-end function called \cw{frontend_default_colour()} (see \k{frontend-default-colour}) or the utility function called @@ -1439,7 +1439,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -580,7 +580,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); int i; @@ -1019,7 +1019,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -864,7 +864,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->blit_peg = blitter_new(dr, ds->pegsz, ds->pegsz); } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float), max; int i; @@ -1692,7 +1692,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->player_background = blitter_new(dr, TILESIZE, TILESIZE); } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); int i; @@ -1956,7 +1956,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->crad = 3*(tilesize-1)/8; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); int i; @@ -2363,7 +2363,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->linewidth = max(1,tilesize/16); } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(4 * NCOLOURS, float); @@ -2527,7 +2527,7 @@ const int map_hatching[FOUR] = { HATCH_VERT, HATCH_SLASH, HATCH_HORIZ, HATCH_BACKSLASH }; -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -767,20 +767,9 @@ void midend_timer(midend *me, float tplus) float *midend_colours(midend *me, int *ncolours) { - game_state *state = NULL; float *ret; - if (me->nstates == 0) { - char *aux = NULL; - char *desc = me->ourgame->new_desc(me->params, me->random, - &aux, TRUE); - state = me->ourgame->new_game(me, me->params, desc); - sfree(desc); - sfree(aux); - } else - state = me->states[0].state; - - ret = me->ourgame->colours(me->frontend, state, ncolours); + ret = me->ourgame->colours(me->frontend, ncolours); { int i; @@ -810,9 +799,6 @@ float *midend_colours(midend *me, int *ncolours) } } - if (me->nstates == 0) - me->ourgame->free_game(state); - return ret; } @@ -2638,7 +2638,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -2138,7 +2138,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret; @@ -1211,7 +1211,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret; @@ -183,7 +183,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -963,7 +963,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -940,7 +940,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->drag_background = blitter_new(dr, TILESIZE, TILESIZE); } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -383,7 +383,7 @@ struct game { void (*compute_size)(game_params *params, int tilesize, int *x, int *y); void (*set_size)(drawing *dr, game_drawstate *ds, game_params *params, int tilesize); - float *(*colours)(frontend *fe, game_state *state, int *ncolours); + float *(*colours)(frontend *fe, int *ncolours); game_drawstate *(*new_drawstate)(drawing *dr, game_state *state); void (*free_drawstate)(drawing *dr, game_drawstate *ds); void (*redraw)(drawing *dr, game_drawstate *ds, game_state *oldstate, @@ -2528,7 +2528,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -1362,7 +1362,7 @@ static void game_compute_size(game_params *params, int tilesize, *y = TILE_SIZE * params->h + 2 * BORDER - TILE_GAP; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -702,7 +702,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); int i; @@ -1707,7 +1707,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -2712,7 +2712,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -1810,7 +1810,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); @@ -761,7 +761,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); int i; @@ -1191,7 +1191,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds, ds->tilesize = tilesize; } -static float *game_colours(frontend *fe, game_state *state, int *ncolours) +static float *game_colours(frontend *fe, int *ncolours) { float *ret = snewn(3 * NCOLOURS, float); |