aboutsummaryrefslogtreecommitdiff
path: root/untangle.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 /untangle.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 'untangle.c')
-rw-r--r--untangle.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/untangle.c b/untangle.c
index 12e5c75..74a5e10 100644
--- a/untangle.c
+++ b/untangle.c
@@ -1000,8 +1000,8 @@ static char *solve_game(game_state *state, game_state *currstate,
pts[i].d = 2;
ox *= pts[i].d;
oy *= pts[i].d;
- pts[i].x = ox + 0.5;
- pts[i].y = oy + 0.5;
+ pts[i].x = (long)(ox + 0.5F);
+ pts[i].y = (long)(oy + 0.5F);
extra = sprintf(buf, ";P%d:%ld,%ld/%ld", i,
pts[i].x, pts[i].y, pts[i].d);
@@ -1077,7 +1077,7 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
{
int n = state->params.n;
- if (button == LEFT_BUTTON) {
+ if (IS_MOUSE_DOWN(button)) {
int i, best;
long bestd;
@@ -1111,12 +1111,12 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
return "";
}
- } else if (button == LEFT_DRAG && ui->dragpoint >= 0) {
+ } else if (IS_MOUSE_DRAG(button) && ui->dragpoint >= 0) {
ui->newpoint.x = x;
ui->newpoint.y = y;
ui->newpoint.d = ds->tilesize;
return "";
- } else if (button == LEFT_RELEASE && ui->dragpoint >= 0) {
+ } else if (IS_MOUSE_RELEASE(button) && ui->dragpoint >= 0) {
int p = ui->dragpoint;
char buf[80];
@@ -1268,8 +1268,8 @@ static point mix(point a, point b, float distance)
point ret;
ret.d = a.d * b.d;
- ret.x = a.x * b.d + distance * (b.x * a.d - a.x * b.d);
- ret.y = a.y * b.d + distance * (b.y * a.d - a.y * b.d);
+ ret.x = (long)(a.x * b.d + distance * (b.x * a.d - a.x * b.d));
+ ret.y = (long)(a.y * b.d + distance * (b.y * a.d - a.y * b.d));
return ret;
}