aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2013-02-24 12:52:17 +0000
committerSimon Tatham <anakin@pobox.com>2013-02-24 12:52:17 +0000
commit4a1669b9add42308bde1dc9dfe3a3b915563679e (patch)
tree27895d0407b5860409f31e19cc713c8143eb03af
parente0f5e4926549e6c0715f7438ec6b2fd07e9be3c2 (diff)
downloadpuzzles-4a1669b9add42308bde1dc9dfe3a3b915563679e.zip
puzzles-4a1669b9add42308bde1dc9dfe3a3b915563679e.tar.gz
puzzles-4a1669b9add42308bde1dc9dfe3a3b915563679e.tar.bz2
puzzles-4a1669b9add42308bde1dc9dfe3a3b915563679e.tar.xz
Stop using CLUE2CHAR to translate clues into text; just do the obvious
sprintf in both locations (screen and print) that need it. Fixes a bug in which clues greater than 9 came out as hex digits in printed puzzles. [originally from svn r9765]
-rw-r--r--loopy.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/loopy.c b/loopy.c
index 0ee1098..6b3d53e 100644
--- a/loopy.c
+++ b/loopy.c
@@ -2997,14 +2997,9 @@ static void game_redraw_clue(drawing *dr, game_drawstate *ds,
grid *g = state->game_grid;
grid_face *f = g->faces + i;
int x, y;
- char c[3];
+ char c[20];
- if (state->clues[i] < 10) {
- c[0] = CLUE2CHAR(state->clues[i]);
- c[1] = '\0';
- } else {
- sprintf(c, "%d", state->clues[i]);
- }
+ sprintf(c, "%d", state->clues[i]);
face_text_pos(ds, g, f, &x, &y);
draw_text(dr, x, y,
@@ -3339,10 +3334,9 @@ static void game_print(drawing *dr, game_state *state, int tilesize)
grid_face *f = g->faces + i;
int clue = state->clues[i];
if (clue >= 0) {
- char c[2];
+ char c[20];
int x, y;
- c[0] = CLUE2CHAR(clue);
- c[1] = '\0';
+ sprintf(c, "%d", state->clues[i]);
face_text_pos(ds, g, f, &x, &y);
draw_text(dr, x, y,
FONT_VARIABLE, ds->tilesize / 2,