diff options
| author | Chris Boyle <chris@boyle.name> | 2015-11-28 13:56:39 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2015-11-28 15:13:24 +0000 |
| commit | 346584bf6e38232be8773c24fd7dedcbd7b3d9ed (patch) | |
| tree | 5f0043c70e1ffbcdf48eda481c64619c413dba4b | |
| parent | 2acd8baae8e411fae3235a5ab5c25b7523e55132 (diff) | |
| download | puzzles-346584bf6e38232be8773c24fd7dedcbd7b3d9ed.zip puzzles-346584bf6e38232be8773c24fd7dedcbd7b3d9ed.tar.gz puzzles-346584bf6e38232be8773c24fd7dedcbd7b3d9ed.tar.bz2 puzzles-346584bf6e38232be8773c24fd7dedcbd7b3d9ed.tar.xz | |
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.
| -rw-r--r-- | bridges.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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; |