aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blackbox.c2
-rw-r--r--bridges.c2
-rw-r--r--cube.c2
-rw-r--r--devel.but12
-rw-r--r--dominosa.c2
-rw-r--r--fifteen.c2
-rw-r--r--flip.c2
-rw-r--r--guess.c2
-rw-r--r--inertia.c2
-rw-r--r--lightup.c2
-rw-r--r--loopy.c2
-rw-r--r--map.c2
-rw-r--r--midend.c16
-rw-r--r--mines.c2
-rw-r--r--net.c2
-rw-r--r--netslide.c2
-rw-r--r--nullgame.c2
-rw-r--r--pattern.c2
-rw-r--r--pegs.c2
-rw-r--r--puzzles.h2
-rw-r--r--rect.c2
-rw-r--r--samegame.c2
-rw-r--r--sixteen.c2
-rw-r--r--slant.c2
-rw-r--r--solo.c2
-rw-r--r--tents.c2
-rw-r--r--twiddle.c2
-rw-r--r--untangle.c2
28 files changed, 29 insertions, 51 deletions
diff --git a/blackbox.c b/blackbox.c
index b8c6bc0..39957f8 100644
--- a/blackbox.c
+++ b/blackbox.c
@@ -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;
diff --git a/bridges.c b/bridges.c
index a6cad87..071c111 100644
--- a/bridges.c
+++ b/bridges.c
@@ -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;
diff --git a/cube.c b/cube.c
index 99d5bb1..283750b 100644
--- a/cube.c
+++ b/cube.c
@@ -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);
diff --git a/devel.but b/devel.but
index 66413ec..8696c83 100644
--- a/devel.but
+++ b/devel.but
@@ -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
diff --git a/dominosa.c b/dominosa.c
index f08cbf6..40fb47d 100644
--- a/dominosa.c
+++ b/dominosa.c
@@ -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);
diff --git a/fifteen.c b/fifteen.c
index 9519f1a..b9ff617 100644
--- a/fifteen.c
+++ b/fifteen.c
@@ -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;
diff --git a/flip.c b/flip.c
index 16f8bc2..dc09a9a 100644
--- a/flip.c
+++ b/flip.c
@@ -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);
diff --git a/guess.c b/guess.c
index d31d061..67abe20 100644
--- a/guess.c
+++ b/guess.c
@@ -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;
diff --git a/inertia.c b/inertia.c
index 055d264..93345fe 100644
--- a/inertia.c
+++ b/inertia.c
@@ -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;
diff --git a/lightup.c b/lightup.c
index 841458a..3a23af4 100644
--- a/lightup.c
+++ b/lightup.c
@@ -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;
diff --git a/loopy.c b/loopy.c
index 406c72f..5bdb647 100644
--- a/loopy.c
+++ b/loopy.c
@@ -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);
diff --git a/map.c b/map.c
index 5943683..f258b8a 100644
--- a/map.c
+++ b/map.c
@@ -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);
diff --git a/midend.c b/midend.c
index 979a3b6..0d19beb 100644
--- a/midend.c
+++ b/midend.c
@@ -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;
}
diff --git a/mines.c b/mines.c
index b9bb7c9..c500ac4 100644
--- a/mines.c
+++ b/mines.c
@@ -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);
diff --git a/net.c b/net.c
index 82d9ed0..47929ff 100644
--- a/net.c
+++ b/net.c
@@ -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;
diff --git a/netslide.c b/netslide.c
index c710e71..75c9498 100644
--- a/netslide.c
+++ b/netslide.c
@@ -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;
diff --git a/nullgame.c b/nullgame.c
index 799a8a5..6ddc786 100644
--- a/nullgame.c
+++ b/nullgame.c
@@ -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);
diff --git a/pattern.c b/pattern.c
index f034bd4..0dcac59 100644
--- a/pattern.c
+++ b/pattern.c
@@ -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);
diff --git a/pegs.c b/pegs.c
index 9b98c70..592bf8b 100644
--- a/pegs.c
+++ b/pegs.c
@@ -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);
diff --git a/puzzles.h b/puzzles.h
index f4fc67f..e910b3c 100644
--- a/puzzles.h
+++ b/puzzles.h
@@ -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,
diff --git a/rect.c b/rect.c
index 60c8e94..62b678e 100644
--- a/rect.c
+++ b/rect.c
@@ -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);
diff --git a/samegame.c b/samegame.c
index 387216d..08ac758 100644
--- a/samegame.c
+++ b/samegame.c
@@ -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);
diff --git a/sixteen.c b/sixteen.c
index fbed055..3c5ddbe 100644
--- a/sixteen.c
+++ b/sixteen.c
@@ -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;
diff --git a/slant.c b/slant.c
index ebc5bbb..8b4e414 100644
--- a/slant.c
+++ b/slant.c
@@ -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);
diff --git a/solo.c b/solo.c
index eb8ad80..0e24481 100644
--- a/solo.c
+++ b/solo.c
@@ -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);
diff --git a/tents.c b/tents.c
index 869ba5e..3788ae5 100644
--- a/tents.c
+++ b/tents.c
@@ -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);
diff --git a/twiddle.c b/twiddle.c
index b366fd7..0de1c45 100644
--- a/twiddle.c
+++ b/twiddle.c
@@ -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;
diff --git a/untangle.c b/untangle.c
index 3d0918a..4e1067c 100644
--- a/untangle.c
+++ b/untangle.c
@@ -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);