From 346584bf6e38232be8773c24fd7dedcbd7b3d9ed Mon Sep 17 00:00:00 2001 From: Chris Boyle Date: Sat, 28 Nov 2015 13:56:39 +0000 Subject: [PATCH] Allow unlocking an island despite moving slightly. Previously moving 1 pixel would be treated as a failed drag and not an unlock. Now you only have to release the button somewhere on the island you started on. --- bridges.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bridges.c b/bridges.c index 6f0e02d..25d3175 100644 --- a/bridges.c +++ b/bridges.c @@ -2339,14 +2339,16 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { if (!INGRID(state, gx, gy)) return NULL; ui->cur_visible = 0; - if ((ggrid & G_ISLAND) && !(ggrid & G_MARK)) { + if (ggrid & G_ISLAND) { ui->dragx_src = gx; ui->dragy_src = gy; return ""; } else return ui_cancel_drag(ui); } else if (button == LEFT_DRAG || button == RIGHT_DRAG) { - if (gx != ui->dragx_src || gy != ui->dragy_src) { + if (INGRID(state, ui->dragx_src, ui->dragy_src) + && (gx != ui->dragx_src || gy != ui->dragy_src) + && !(GRID(state,ui->dragx_src,ui->dragy_src) & G_MARK)) { ui->dragging = 1; ui->drag_is_noline = (button == RIGHT_DRAG) ? 1 : 0; return update_drag_dst(state, ui, ds, x, y); @@ -2360,6 +2362,10 @@ static char *interpret_move(const game_state *state, game_ui *ui, if (ui->dragging) { return finish_drag(state, ui); } else { + if (!INGRID(state, ui->dragx_src, ui->dragy_src) + || gx != ui->dragx_src || gy != ui->dragy_src) { + return ui_cancel_drag(ui); + } ui_cancel_drag(ui); if (!INGRID(state, gx, gy)) return NULL; if (!(GRID(state, gx, gy) & G_ISLAND)) return NULL; -- 2.30.2