aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2021-04-26 17:59:22 +0100
committerSimon Tatham <anakin@pobox.com>2021-04-26 18:05:00 +0100
commitf2f39af2d3ca27ee9aa2e284896efa07f5df5f02 (patch)
tree37cbf70d9200589b01988e4ed062e6bf9dc8256c
parent2409a9913e1b3972ff4ef3b4ab377ace9b5d4ef7 (diff)
downloadpuzzles-f2f39af2d3ca27ee9aa2e284896efa07f5df5f02.zip
puzzles-f2f39af2d3ca27ee9aa2e284896efa07f5df5f02.tar.gz
puzzles-f2f39af2d3ca27ee9aa2e284896efa07f5df5f02.tar.bz2
puzzles-f2f39af2d3ca27ee9aa2e284896efa07f5df5f02.tar.xz
Mosaic: use signed char for clue values.
Negative numbers are used as a sentinel for an absent clue, so we have to use a type that's guaranteed to have some negative numbers. char is unsigned on some platforms. So now Mosaic runs apparently correctly on Raspbian, for example.
-rw-r--r--mosaic.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/mosaic.c b/mosaic.c
index 20a56cf..8294f84 100644
--- a/mosaic.c
+++ b/mosaic.c
@@ -98,12 +98,12 @@ struct board_state {
};
struct board_cell {
- char clue;
+ signed char clue;
bool shown;
};
struct solution_cell {
- char cell;
+ signed char cell;
bool solved;
bool needed;
};
@@ -1426,7 +1426,7 @@ static void game_free_drawstate(drawing *dr, game_drawstate *ds)
sfree(ds);
}
-static void draw_cell(drawing *dr, int cell, int ts, char clue_val,
+static void draw_cell(drawing *dr, int cell, int ts, signed char clue_val,
int x, int y)
{
int startX = ((x * ts) + ts / 2) - 1, startY = ((y * ts) + ts / 2) - 1;
@@ -1468,7 +1468,8 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
float flashtime)
{
int x, y;
- char status[80], clue_val;
+ char status[80];
+ signed char clue_val;
bool flashing = (flashtime > 0 && (flashtime <= FLASH_TIME / 3 ||
flashtime > 2*FLASH_TIME / 3));