diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-07-10 09:27:08 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-07-10 09:27:08 +0000 |
| commit | ac36314b021854a642593be87a99cad9b04333a5 (patch) | |
| tree | 64edc4086ab91a96c9ad70dd9868bcf5081b6291 | |
| parent | 2ec5a51c35c12b861eacd2e4566ba786c1270803 (diff) | |
| download | puzzles-ac36314b021854a642593be87a99cad9b04333a5.zip puzzles-ac36314b021854a642593be87a99cad9b04333a5.tar.gz puzzles-ac36314b021854a642593be87a99cad9b04333a5.tar.bz2 puzzles-ac36314b021854a642593be87a99cad9b04333a5.tar.xz | |
Subtle UI change to Mines. Although I mostly find the unified left-
button interface (same button to open a closed square or to clear
around an open one) to be a massive help, there is one circumstance
in which it frequently kills me: if I click down on an open square I
want to clear around, then the mouse pointer accidentally drifts
over on to the nearest closed square before I release, I'll end up
opening that square instead and (usually) dying. So this checkin
causes Mines to note which type of square I left-clicked on, and to
do nothing if the button release is on the other type.
[originally from svn r6086]
| -rw-r--r-- | mines.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -2334,6 +2334,7 @@ static char *game_text_format(game_state *state) struct game_ui { int hx, hy, hradius; /* for mouse-down highlights */ + int validradius; int flash_is_death; int deaths; }; @@ -2342,7 +2343,7 @@ static game_ui *new_ui(game_state *state) { game_ui *ui = snew(game_ui); ui->hx = ui->hy = -1; - ui->hradius = 0; + ui->hradius = ui->validradius = 0; ui->deaths = 0; ui->flash_is_death = FALSE; /* *shrug* */ return ui; @@ -2416,6 +2417,10 @@ static char *interpret_move(game_state *from, game_ui *ui, game_drawstate *ds, ui->hx = cx; ui->hy = cy; ui->hradius = (from->grid[cy*from->w+cx] >= 0 ? 1 : 0); + if (button == LEFT_BUTTON) + ui->validradius = ui->hradius; + else if (button == MIDDLE_BUTTON) + ui->validradius = 1; return ""; } @@ -2456,7 +2461,8 @@ static char *interpret_move(game_state *from, game_ui *ui, game_drawstate *ds, */ if (button == LEFT_RELEASE && (from->grid[cy * from->w + cx] == -2 || - from->grid[cy * from->w + cx] == -3)) { + from->grid[cy * from->w + cx] == -3) && + ui->validradius == 0) { /* Check if you've killed yourself. */ if (from->layout->mines && from->layout->mines[cy * from->w + cx]) ui->deaths++; @@ -2471,7 +2477,7 @@ static char *interpret_move(game_state *from, game_ui *ui, game_drawstate *ds, * surrounding the tile is equal to its mine count, and if * so then we open all other surrounding squares. */ - if (from->grid[cy * from->w + cx] > 0) { + if (from->grid[cy * from->w + cx] > 0 && ui->validradius == 1) { int dy, dx, n; /* Count mine markers. */ |