~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bounds checking for Flip cursor control.
[sgt/puzzles]
/
sixteen.c
diff --git
a/sixteen.c
b/sixteen.c
index
6c158d5
..
72585c1
100644
(file)
--- a/
sixteen.c
+++ b/
sixteen.c
@@
-195,7
+195,7
@@
static int perm_parity(int *perm, int n)
}
static char *new_game_desc(game_params *params, random_state *rs,
}
static char *new_game_desc(game_params *params, random_state *rs,
-
game_aux_info
**aux, int interactive)
+
char
**aux, int interactive)
{
int stop, n, i, x;
int x1, x2, p1, p2;
{
int stop, n, i, x;
int x1, x2, p1, p2;
@@
-398,11
+398,6
@@
static char *new_game_desc(game_params *params, random_state *rs,
return ret;
}
return ret;
}
-static void game_free_aux_info(game_aux_info *aux)
-{
- assert(!"Shouldn't happen");
-}
-
static char *validate_desc(game_params *params, char *desc)
{
static char *validate_desc(game_params *params, char *desc)
{
@@
-511,7
+506,7
@@
static void free_game(game_state *state)
}
static char *solve_game(game_state *state, game_state *currstate,
}
static char *solve_game(game_state *state, game_state *currstate,
-
game_aux_info
*aux, char **error)
+
char
*aux, char **error)
{
return dupstr("S");
}
{
return dupstr("S");
}
@@
-564,6
+559,15
@@
static void free_ui(game_ui *ui)
{
}
{
}
+static char *encode_ui(game_ui *ui)
+{
+ return NULL;
+}
+
+static void decode_ui(game_ui *ui, char *encoding)
+{
+}
+
static void game_changed_state(game_ui *ui, game_state *oldstate,
game_state *newstate)
{
static void game_changed_state(game_ui *ui, game_state *oldstate,
game_state *newstate)
{
@@
-774,13
+778,11
@@
static void draw_tile(frontend *fe, game_drawstate *ds,
coords[3] = y;
coords[4] = x;
coords[5] = y + TILE_SIZE - 1;
coords[3] = y;
coords[4] = x;
coords[5] = y + TILE_SIZE - 1;
- draw_polygon(fe, coords, 3, TRUE, COL_LOWLIGHT);
- draw_polygon(fe, coords, 3, FALSE, COL_LOWLIGHT);
+ draw_polygon(fe, coords, 3, COL_LOWLIGHT, COL_LOWLIGHT);
coords[0] = x;
coords[1] = y;
coords[0] = x;
coords[1] = y;
- draw_polygon(fe, coords, 3, TRUE, COL_HIGHLIGHT);
- draw_polygon(fe, coords, 3, FALSE, COL_HIGHLIGHT);
+ draw_polygon(fe, coords, 3, COL_HIGHLIGHT, COL_HIGHLIGHT);
draw_rect(fe, x + HIGHLIGHT_WIDTH, y + HIGHLIGHT_WIDTH,
TILE_SIZE - 2*HIGHLIGHT_WIDTH, TILE_SIZE - 2*HIGHLIGHT_WIDTH,
draw_rect(fe, x + HIGHLIGHT_WIDTH, y + HIGHLIGHT_WIDTH,
TILE_SIZE - 2*HIGHLIGHT_WIDTH, TILE_SIZE - 2*HIGHLIGHT_WIDTH,
@@
-812,8
+814,7
@@
static void draw_arrow(frontend *fe, game_drawstate *ds,
POINT(5, 3 * TILE_SIZE / 8, TILE_SIZE / 2); /* left concave */
POINT(6, TILE_SIZE / 4, TILE_SIZE / 2); /* left corner */
POINT(5, 3 * TILE_SIZE / 8, TILE_SIZE / 2); /* left concave */
POINT(6, TILE_SIZE / 4, TILE_SIZE / 2); /* left corner */
- draw_polygon(fe, coords, 7, TRUE, COL_LOWLIGHT);
- draw_polygon(fe, coords, 7, FALSE, COL_TEXT);
+ draw_polygon(fe, coords, 7, COL_LOWLIGHT, COL_TEXT);
}
static void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
}
static void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
@@
-851,13
+852,11
@@
static void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
coords[9] = COORD(state->h) + HIGHLIGHT_WIDTH - 1;
coords[6] = coords[8] + TILE_SIZE;
coords[7] = coords[9] - TILE_SIZE;
coords[9] = COORD(state->h) + HIGHLIGHT_WIDTH - 1;
coords[6] = coords[8] + TILE_SIZE;
coords[7] = coords[9] - TILE_SIZE;
- draw_polygon(fe, coords, 5, TRUE, COL_HIGHLIGHT);
- draw_polygon(fe, coords, 5, FALSE, COL_HIGHLIGHT);
+ draw_polygon(fe, coords, 5, COL_HIGHLIGHT, COL_HIGHLIGHT);
coords[1] = COORD(0) - HIGHLIGHT_WIDTH;
coords[0] = COORD(0) - HIGHLIGHT_WIDTH;
coords[1] = COORD(0) - HIGHLIGHT_WIDTH;
coords[0] = COORD(0) - HIGHLIGHT_WIDTH;
- draw_polygon(fe, coords, 5, TRUE, COL_LOWLIGHT);
- draw_polygon(fe, coords, 5, FALSE, COL_LOWLIGHT);
+ draw_polygon(fe, coords, 5, COL_LOWLIGHT, COL_LOWLIGHT);
/*
* Arrows for making moves.
/*
* Arrows for making moves.
@@
-1051,7
+1050,6
@@
const struct game thegame = {
TRUE, game_configure, custom_params,
validate_params,
new_game_desc,
TRUE, game_configure, custom_params,
validate_params,
new_game_desc,
- game_free_aux_info,
validate_desc,
new_game,
dup_game,
validate_desc,
new_game,
dup_game,
@@
-1060,6
+1058,8
@@
const struct game thegame = {
TRUE, game_text_format,
new_ui,
free_ui,
TRUE, game_text_format,
new_ui,
free_ui,
+ encode_ui,
+ decode_ui,
game_changed_state,
interpret_move,
execute_move,
game_changed_state,
interpret_move,
execute_move,