* and simply shuffle the grid by making a long sequence of
* randomly chosen moves.
*/
- total_moves = w*h*n*n*2;
+ total_moves = w*h*n*n*2 + random_upto(rs, 1);
for (i = 0; i < total_moves; i++) {
int x, y;
char **error)
{
game_state *ret = dup_game(state);
+ int i;
/*
* Simply replace the grid with a solved one. For this game,
* which to practise manoeuvres.
*/
qsort(ret->grid, ret->w*ret->h, sizeof(int), compare_int);
+ for (i = 0; i < ret->w*ret->h; i++)
+ ret->grid[i] &= ~3;
ret->used_solve = ret->just_used_solve = TRUE;
- ret->completed = ret->movecount;
+ ret->completed = ret->movecount = 1;
return ret;
}
*/
maxlen = state->h * state->w * (col+o+1);
- ret = snewn(maxlen, char);
+ ret = snewn(maxlen+1, char);
p = ret;
for (y = 0; y < state->h; y++) {
int coords[8];
char str[40];
+ /*
+ * If we've been passed a rotation region but we're drawing a
+ * tile which is outside it, we must draw it normally. This can
+ * occur if we're cleaning up after a completion flash while a
+ * new move is also being made.
+ */
+ if (rot && (x < rot->cx || y < rot->cy ||
+ x >= rot->cx+rot->cw || y > rot->cy+rot->ch))
+ rot = NULL;
+
if (rot)
clip(fe, rot->cx, rot->cy, rot->cw, rot->ch);
}
/*
- * Next, the colour bars for orientation.
+ * Next, the triangles for orientation.
*/
if (state->orientable) {
int xdx, xdy, ydx, ydy;