aboutsummaryrefslogtreecommitdiff
path: root/map.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2012-09-09 18:40:12 +0000
committerSimon Tatham <anakin@pobox.com>2012-09-09 18:40:12 +0000
commit3b250baa02a7332510685948bf17576c397b8ceb (patch)
treedb43c6ec326fee66d6612e363b83e021054ec87f /map.c
parent55748a60cbd964f697f84ed57c8fc5299406fcdf (diff)
downloadpuzzles-3b250baa02a7332510685948bf17576c397b8ceb.zip
puzzles-3b250baa02a7332510685948bf17576c397b8ceb.tar.gz
puzzles-3b250baa02a7332510685948bf17576c397b8ceb.tar.bz2
puzzles-3b250baa02a7332510685948bf17576c397b8ceb.tar.xz
New rule: interpret_move() is passed a pointer to the game_drawstate
basically just so that it can divide mouse coordinates by the tile size, but is definitely not expected to _write_ to it, and it hadn't previously occurred to me that anyone might try. Therefore, interpret_move() now gets a pointer to a _const_ game_drawstate instead of a writable one. All existing puzzles cope fine with this API change (as long as the new const qualifier is also added to a couple of subfunctions to which interpret_move delegates work), except for the just-committed Undead, which somehow had ds->ascii and ui->ascii the wrong way round but is otherwise unproblematic. [originally from svn r9657]
Diffstat (limited to 'map.c')
-rw-r--r--map.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/map.c b/map.c
index 5d170d1..af7c0af 100644
--- a/map.c
+++ b/map.c
@@ -2342,7 +2342,7 @@ struct game_drawstate {
((button) == CURSOR_UP) ? -1 : 0)
-static int region_from_coords(game_state *state, game_drawstate *ds,
+static int region_from_coords(game_state *state, const game_drawstate *ds,
int x, int y)
{
int w = state->p.w, h = state->p.h, wh = w*h /*, n = state->p.n */;
@@ -2361,7 +2361,7 @@ static int region_from_coords(game_state *state, game_drawstate *ds,
return state->map->map[quadrant * wh + ty*w+tx];
}
-static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
+static char *interpret_move(game_state *state, game_ui *ui, const game_drawstate *ds,
int x, int y, int button)
{
char *bufp, buf[256];