mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Fix display glitch in Jigsaw Solo's pencil-mode cursor.
In Jigsaw Solo, block boundaries aren't convex, so it's possible for one of them to have an inward corner. If that corner is in the top left of a selectable cell, and you right-click that cell to display the pencil-mode 'cursor' in the form of a triangle in the top left, then the cursor was accidentally drawn on top of the block boundary, where it ought to be underneath it. For example, in game id 5j:d1d4_4c3_1d2d,bb_baaa_dca_baaba, right- clicking in the bottom right square of the grid demonstrates the problem. Jonas Kölker fixed this for Keen in 2015, in commit 6482ed0e3c886af. This is the identical fix, in Solo's very similar-looking drawing routine. I feel embarrassed to have taken eight years to get round to it!
This commit is contained in:
24
solo.c
24
solo.c
@ -4986,6 +4986,18 @@ static void draw_number(drawing *dr, game_drawstate *ds,
|
||||
(ds->xtype && (ondiag0(y*cr+x) || ondiag1(y*cr+x))) ? COL_XDIAGONALS :
|
||||
COL_BACKGROUND));
|
||||
|
||||
/* pencil-mode highlight */
|
||||
if ((hl & 15) == 2) {
|
||||
int coords[6];
|
||||
coords[0] = cx;
|
||||
coords[1] = cy;
|
||||
coords[2] = cx+cw/2;
|
||||
coords[3] = cy;
|
||||
coords[4] = cx;
|
||||
coords[5] = cy+ch/2;
|
||||
draw_polygon(dr, coords, 3, COL_HIGHLIGHT, COL_HIGHLIGHT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Draw the corners of thick lines in corner-adjacent squares,
|
||||
* which jut into this square by one pixel.
|
||||
@ -4999,18 +5011,6 @@ static void draw_number(drawing *dr, game_drawstate *ds,
|
||||
if (x+1 < cr && y+1 < cr && state->blocks->whichblock[y*cr+x] != state->blocks->whichblock[(y+1)*cr+x+1])
|
||||
draw_rect(dr, tx+TILE_SIZE-1-2*GRIDEXTRA, ty+TILE_SIZE-1-2*GRIDEXTRA, GRIDEXTRA, GRIDEXTRA, COL_GRID);
|
||||
|
||||
/* pencil-mode highlight */
|
||||
if ((hl & 15) == 2) {
|
||||
int coords[6];
|
||||
coords[0] = cx;
|
||||
coords[1] = cy;
|
||||
coords[2] = cx+cw/2;
|
||||
coords[3] = cy;
|
||||
coords[4] = cx;
|
||||
coords[5] = cy+ch/2;
|
||||
draw_polygon(dr, coords, 3, COL_HIGHLIGHT, COL_HIGHLIGHT);
|
||||
}
|
||||
|
||||
if (state->kblocks) {
|
||||
int t = GRIDEXTRA * 3;
|
||||
int kcx, kcy, kcw, kch;
|
||||
|
Reference in New Issue
Block a user