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.
This commit is contained in:
Simon Tatham
2021-04-26 17:59:22 +01:00
parent 2409a9913e
commit f2f39af2d3

View File

@ -98,12 +98,12 @@ struct board_state {
}; };
struct board_cell { struct board_cell {
char clue; signed char clue;
bool shown; bool shown;
}; };
struct solution_cell { struct solution_cell {
char cell; signed char cell;
bool solved; bool solved;
bool needed; bool needed;
}; };
@ -1426,7 +1426,7 @@ static void game_free_drawstate(drawing *dr, game_drawstate *ds)
sfree(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 x, int y)
{ {
int startX = ((x * ts) + ts / 2) - 1, startY = ((y * ts) + ts / 2) - 1; 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) float flashtime)
{ {
int x, y; int x, y;
char status[80], clue_val; char status[80];
signed char clue_val;
bool flashing = (flashtime > 0 && (flashtime <= FLASH_TIME / 3 || bool flashing = (flashtime > 0 && (flashtime <= FLASH_TIME / 3 ||
flashtime > 2*FLASH_TIME / 3)); flashtime > 2*FLASH_TIME / 3));