mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
We should turn off the dragging variables in the UI _whenever_
`enddrag' is TRUE, not just when the end of the drag was within a sensible range. [originally from svn r4210]
This commit is contained in:
59
rect.c
59
rect.c
@ -1009,38 +1009,45 @@ game_state *make_move(game_state *from, game_ui *ui, int x, int y, int button)
|
|||||||
active = TRUE;
|
active = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enddrag && (xc >= 0 && xc <= 2*from->w &&
|
ret = NULL;
|
||||||
yc >= 0 && yc <= 2*from->h)) {
|
|
||||||
ret = dup_game(from);
|
|
||||||
|
|
||||||
if (ui->dragged) {
|
if (enddrag) {
|
||||||
ui_draw_rect(ret, ui, ret->hedge, ret->vedge, 1);
|
if (xc >= 0 && xc <= 2*from->w &&
|
||||||
} else {
|
yc >= 0 && yc <= 2*from->h) {
|
||||||
if ((xc & 1) && !(yc & 1) && HRANGE(from,xc/2,yc/2)) {
|
ret = dup_game(from);
|
||||||
hedge(ret,xc/2,yc/2) = !hedge(ret,xc/2,yc/2);
|
|
||||||
}
|
|
||||||
if ((yc & 1) && !(xc & 1) && VRANGE(from,xc/2,yc/2)) {
|
|
||||||
vedge(ret,xc/2,yc/2) = !vedge(ret,xc/2,yc/2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->drag_start_x = -1;
|
if (ui->dragged) {
|
||||||
ui->drag_start_y = -1;
|
ui_draw_rect(ret, ui, ret->hedge, ret->vedge, 1);
|
||||||
ui->drag_end_x = -1;
|
} else {
|
||||||
ui->drag_end_y = -1;
|
if ((xc & 1) && !(yc & 1) && HRANGE(from,xc/2,yc/2)) {
|
||||||
ui->dragged = FALSE;
|
hedge(ret,xc/2,yc/2) = !hedge(ret,xc/2,yc/2);
|
||||||
active = TRUE;
|
}
|
||||||
|
if ((yc & 1) && !(xc & 1) && VRANGE(from,xc/2,yc/2)) {
|
||||||
|
vedge(ret,xc/2,yc/2) = !vedge(ret,xc/2,yc/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!memcmp(ret->hedge, from->hedge, from->w*from->h) &&
|
if (!memcmp(ret->hedge, from->hedge, from->w*from->h) &&
|
||||||
!memcmp(ret->vedge, from->vedge, from->w*from->h)) {
|
!memcmp(ret->vedge, from->vedge, from->w*from->h)) {
|
||||||
free_game(ret);
|
free_game(ret);
|
||||||
} else
|
ret = NULL;
|
||||||
return ret; /* a move has been made */
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->drag_start_x = -1;
|
||||||
|
ui->drag_start_y = -1;
|
||||||
|
ui->drag_end_x = -1;
|
||||||
|
ui->drag_end_y = -1;
|
||||||
|
ui->dragged = FALSE;
|
||||||
|
active = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active)
|
if (ret)
|
||||||
|
return ret; /* a move has been made */
|
||||||
|
else if (active)
|
||||||
return from; /* UI activity has occurred */
|
return from; /* UI activity has occurred */
|
||||||
return NULL;
|
else
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user