mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Pattern's display was broken for non-square puzzles, because
draw_numbers() was considerably confused between the width of the clue border at the left and the height of the clue border at the top. Unconfuse it (I think). [originally from svn r9737]
This commit is contained in:
16
pattern.c
16
pattern.c
@ -1310,11 +1310,11 @@ static void draw_numbers(drawing *dr, game_drawstate *ds, game_state *state,
|
|||||||
if (erase) {
|
if (erase) {
|
||||||
if (i < state->w) {
|
if (i < state->w) {
|
||||||
draw_rect(dr, TOCOORD(state->w, i), 0,
|
draw_rect(dr, TOCOORD(state->w, i), 0,
|
||||||
TILE_SIZE, BORDER + TLBORDER(state->w) * TILE_SIZE,
|
TILE_SIZE, BORDER + TLBORDER(state->h) * TILE_SIZE,
|
||||||
COL_BACKGROUND);
|
COL_BACKGROUND);
|
||||||
} else {
|
} else {
|
||||||
draw_rect(dr, 0, TOCOORD(state->h, i - state->w),
|
draw_rect(dr, 0, TOCOORD(state->h, i - state->w),
|
||||||
BORDER + TLBORDER(state->h) * TILE_SIZE, TILE_SIZE,
|
BORDER + TLBORDER(state->w) * TILE_SIZE, TILE_SIZE,
|
||||||
COL_BACKGROUND);
|
COL_BACKGROUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1324,7 +1324,11 @@ static void draw_numbers(drawing *dr, game_drawstate *ds, game_state *state,
|
|||||||
* tile size. However, if there are more numbers than available
|
* tile size. However, if there are more numbers than available
|
||||||
* spaces, I have to squash them up a bit.
|
* spaces, I have to squash them up a bit.
|
||||||
*/
|
*/
|
||||||
nfit = max(rowlen, TLBORDER(state->h))-1;
|
if (i < state->w)
|
||||||
|
nfit = TLBORDER(state->h);
|
||||||
|
else
|
||||||
|
nfit = TLBORDER(state->w);
|
||||||
|
nfit = max(rowlen, nfit) - 1;
|
||||||
assert(nfit > 0);
|
assert(nfit > 0);
|
||||||
|
|
||||||
for (j = 0; j < rowlen; j++) {
|
for (j = 0; j < rowlen; j++) {
|
||||||
@ -1338,7 +1342,7 @@ static void draw_numbers(drawing *dr, game_drawstate *ds, game_state *state,
|
|||||||
} else {
|
} else {
|
||||||
y = TOCOORD(state->h, i - state->w);
|
y = TOCOORD(state->h, i - state->w);
|
||||||
x = BORDER + TILE_SIZE * (TLBORDER(state->w)-1);
|
x = BORDER + TILE_SIZE * (TLBORDER(state->w)-1);
|
||||||
x -= ((rowlen-j-1)*TILE_SIZE) * (TLBORDER(state->h)-1) / nfit;
|
x -= ((rowlen-j-1)*TILE_SIZE) * (TLBORDER(state->w)-1) / nfit;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(str, "%d", rowdata[j]);
|
sprintf(str, "%d", rowdata[j]);
|
||||||
@ -1348,10 +1352,10 @@ static void draw_numbers(drawing *dr, game_drawstate *ds, game_state *state,
|
|||||||
|
|
||||||
if (i < state->w) {
|
if (i < state->w) {
|
||||||
draw_update(dr, TOCOORD(state->w, i), 0,
|
draw_update(dr, TOCOORD(state->w, i), 0,
|
||||||
TILE_SIZE, BORDER + TLBORDER(state->w) * TILE_SIZE);
|
TILE_SIZE, BORDER + TLBORDER(state->h) * TILE_SIZE);
|
||||||
} else {
|
} else {
|
||||||
draw_update(dr, 0, TOCOORD(state->h, i - state->w),
|
draw_update(dr, 0, TOCOORD(state->h, i - state->w),
|
||||||
BORDER + TLBORDER(state->h) * TILE_SIZE, TILE_SIZE);
|
BORDER + TLBORDER(state->w) * TILE_SIZE, TILE_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user