aboutsummaryrefslogtreecommitdiff
path: root/cube.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2008-09-13 18:29:20 +0000
committerSimon Tatham <anakin@pobox.com>2008-09-13 18:29:20 +0000
commit1d661ec46b8d7216bc6f2e34a4d6b9cc9fdc6f96 (patch)
tree7d148a3d1d265a36957636faa3b5e7aba92bd1f9 /cube.c
parent5ead207060a3e1f74ad6200fdf02934457394bc2 (diff)
downloadpuzzles-1d661ec46b8d7216bc6f2e34a4d6b9cc9fdc6f96.zip
puzzles-1d661ec46b8d7216bc6f2e34a4d6b9cc9fdc6f96.tar.gz
puzzles-1d661ec46b8d7216bc6f2e34a4d6b9cc9fdc6f96.tar.bz2
puzzles-1d661ec46b8d7216bc6f2e34a4d6b9cc9fdc6f96.tar.xz
Patch from James H providing lots more paranoid casting. Also one
actual behaviour change: Untangle now permits dragging with the right mouse button, which has exactly the same effect as it does with the left. (Harmless on desktop platforms, but helpful when "right-click" is achieved by press-and-hold; now the drag takes place even if you hesitate first.) [originally from svn r8177]
Diffstat (limited to 'cube.c')
-rw-r--r--cube.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/cube.c b/cube.c
index 5df5fcb..60730c0 100644
--- a/cube.c
+++ b/cube.c
@@ -1115,8 +1115,8 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
int cx, cy;
double angle;
- cx = state->squares[state->current].x * GRID_SCALE + ds->ox;
- cy = state->squares[state->current].y * GRID_SCALE + ds->oy;
+ cx = (int)(state->squares[state->current].x * GRID_SCALE) + ds->ox;
+ cy = (int)(state->squares[state->current].y * GRID_SCALE) + ds->oy;
if (x == cx && y == cy)
return NULL; /* clicked in exact centre! */
@@ -1476,7 +1476,7 @@ static void game_set_size(drawing *dr, game_drawstate *ds,
{
struct bbox bb = find_bbox(params);
- ds->gridscale = tilesize;
+ ds->gridscale = (float)tilesize;
ds->ox = (int)(-(bb.l - solids[params->solid]->border) * ds->gridscale);
ds->oy = (int)(-(bb.u - solids[params->solid]->border) * ds->gridscale);
}
@@ -1503,7 +1503,8 @@ static game_drawstate *game_new_drawstate(drawing *dr, game_state *state)
{
struct game_drawstate *ds = snew(struct game_drawstate);
- ds->ox = ds->oy = ds->gridscale = 0.0F;/* not decided yet */
+ ds->ox = ds->oy = 0;
+ ds->gridscale = 0.0F; /* not decided yet */
return ds;
}