ref: a550ea0a47374705a37f36b0f05ffe9e4c8161fb
parent: 064da876828ea3079d5d7be5849b693f4d55364b
author: Simon Tatham <anakin@pobox.com>
date: Tue Nov 13 16:44:02 EST 2018
Replace TRUE/FALSE with C99 true/false throughout. This commit removes the old #defines of TRUE and FALSE from puzzles.h, and does a mechanical search-and-replace throughout the code to replace them with the C99 standard lowercase spellings.
--- a/blackbox.c
+++ b/blackbox.c
@@ -65,7 +65,7 @@
game_params *ret;
if (i < 0 || i >= lenof(blackbox_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = blackbox_presets[i];
@@ -79,7 +79,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -240,7 +240,7 @@
}
sfree(grid);
- obfuscate_bitmap(bmp, (nballs*2 + 2) * 8, FALSE);
+ obfuscate_bitmap(bmp, (nballs*2 + 2) * 8, false);
ret = bin2hex(bmp, nballs*2 + 2);
sfree(bmp);
@@ -261,7 +261,7 @@
return "Game description is wrong length";
bmp = hex2bin(desc, nballs*2 + 2);
- obfuscate_bitmap(bmp, (nballs*2 + 2) * 8, TRUE);
+ obfuscate_bitmap(bmp, (nballs*2 + 2) * 8, true);
ret = "Game description is corrupted";
/* check general grid size */
if (bmp[0] != params->w || bmp[1] != params->h)
@@ -400,7 +400,7 @@
state->nballs = ((dlen/2)-2)/2;
bmp = hex2bin(desc, state->nballs*2 + 2);
- obfuscate_bitmap(bmp, (state->nballs*2 + 2) * 8, TRUE);
+ obfuscate_bitmap(bmp, (state->nballs*2 + 2) * 8, true);
state->w = bmp[0]; state->h = bmp[1];
state->nlasers = 2 * (state->w + state->h);
@@ -465,7 +465,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -485,7 +485,7 @@
game_ui *ui = snew(game_ui);
ui->flash_laserno = LASER_EMPTY;
ui->errors = 0;
- ui->newmove = FALSE;
+ ui->newmove = false;
ui->cur_x = ui->cur_y = 1;
ui->cur_visible = 0;
@@ -524,7 +524,7 @@
*/
if (newstate->justwrong && ui->newmove)
ui->errors++;
- ui->newmove = FALSE;
+ ui->newmove = false;
}
#define OFFSET(gx,gy,o) do { \
@@ -718,7 +718,7 @@
tmp = laser_exit(state, i);
if (RANGECHECK(state, tmp))
state->exits[tmp] |= LASER_WRONG;
- state->justwrong = TRUE;
+ state->justwrong = true;
free_game(guesses);
return 0;
}
@@ -754,7 +754,7 @@
tmp = laser_exit(state, i);
if (RANGECHECK(state, tmp))
state->exits[tmp] |= LASER_OMITTED;
- state->justwrong = TRUE;
+ state->justwrong = true;
free_game(guesses);
return 0;
}
@@ -982,7 +982,7 @@
return nullret;
}
if (state->reveal) return nullret;
- ui->newmove = TRUE;
+ ui->newmove = true;
return dupstr(buf);
}
@@ -993,7 +993,7 @@
if (ret->justwrong) {
int i;
- ret->justwrong = FALSE;
+ ret->justwrong = false;
for (i = 0; i < ret->nlasers; i++)
if (ret->exits[i] != LASER_EMPTY)
ret->exits[i] &= ~(LASER_OMITTED | LASER_WRONG);
@@ -1000,7 +1000,7 @@
}
if (!strcmp(move, "S")) {
- check_guesses(ret, FALSE);
+ check_guesses(ret, false);
return ret;
}
@@ -1034,7 +1034,7 @@
if (ret->nguesses < ret->minballs ||
ret->nguesses > ret->maxballs)
goto badmove;
- check_guesses(ret, TRUE);
+ check_guesses(ret, true);
break;
case 'L':
@@ -1483,7 +1483,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1506,7 +1506,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1513,8 +1513,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1531,9 +1531,9 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON, /* flags */
};
--- a/bridges.c
+++ b/bridges.c
@@ -206,7 +206,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -654,7 +654,7 @@
char buf[80];
if (i < 0 || i >= lenof(bridges_presets))
- return FALSE;
+ return false;
ret = default_params();
*ret = bridges_presets[i];
@@ -665,7 +665,7 @@
ret->difficulty == 1 ? "medium" : "hard");
*name = dupstr(buf);
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -2362,7 +2362,7 @@
if (control || shift) {
ui->dragx_src = ui->cur_x;
ui->dragy_src = ui->cur_y;
- ui->dragging = TRUE;
+ ui->dragging = true;
ui->drag_is_noline = !control;
}
if (ui->dragging) {
@@ -2518,7 +2518,7 @@
while (*move) {
c = *move++;
if (c == 'S') {
- ret->solved = TRUE;
+ ret->solved = true;
n = 0;
} else if (c == 'L') {
if (sscanf(move, "%d,%d,%d,%d,%d%n",
@@ -2950,7 +2950,7 @@
if (flashtime) {
int f = (int)(flashtime * 5 / FLASH_TIME);
- if (f == 1 || f == 3) flash = TRUE;
+ if (f == 1 || f == 3) flash = true;
}
/* Clear screen, if required. */
@@ -3031,7 +3031,7 @@
INDEX(ds,newgrid,x,y+1) |= idata << D_L_ISLAND_SHIFT_U;
} else {
unsigned long hdata, vdata;
- int selh = FALSE, selv = FALSE;
+ int selh = false, selv = false;
/*
* A line (non-island) square. Compute the drawing
@@ -3044,9 +3044,9 @@
WITHIN(x,is_drag_src->x, is_drag_dst->x) &&
WITHIN(y,is_drag_src->y, is_drag_dst->y)) {
if (is_drag_src->x != is_drag_dst->x)
- selh = TRUE;
+ selh = true;
else
- selv = TRUE;
+ selv = true;
}
lines_lvlh(state, ui, x, y, v, &lv, &lh);
@@ -3147,7 +3147,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -3225,7 +3225,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -3232,8 +3232,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -3250,9 +3250,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON, /* flags */
};
--- a/cube.c
+++ b/cube.c
@@ -267,12 +267,12 @@
break;
default:
sfree(ret);
- return FALSE;
+ return false;
}
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -348,7 +348,7 @@
sq.directions[DOWN_LEFT] = 0; /* no diagonals in a square */
sq.directions[DOWN_RIGHT] = 0; /* no diagonals in a square */
- sq.flip = FALSE;
+ sq.flip = false;
/*
* This is supremely irrelevant, but just to avoid
@@ -406,7 +406,7 @@
sq.directions[DOWN_LEFT] = sq.directions[LEFT];
sq.directions[DOWN_RIGHT] = sq.directions[RIGHT];
- sq.flip = TRUE;
+ sq.flip = true;
if (firstix < 0)
firstix = ix & 3;
@@ -451,7 +451,7 @@
sq.directions[UP_LEFT] = sq.directions[LEFT];
sq.directions[UP_RIGHT] = sq.directions[RIGHT];
- sq.flip = FALSE;
+ sq.flip = false;
if (firstix < 0)
firstix = (ix - 1) & 3;
@@ -636,7 +636,7 @@
*/
flags = snewn(area, int);
for (i = 0; i < area; i++)
- flags[i] = FALSE;
+ flags[i] = false;
for (i = 0; i < data.nclasses; i++) {
for (j = 0; j < facesperclass; j++) {
@@ -643,7 +643,7 @@
int n = random_upto(rs, data.nsquares[i]);
assert(!flags[data.gridptrs[i][n]]);
- flags[data.gridptrs[i][n]] = TRUE;
+ flags[data.gridptrs[i][n]] = true;
/*
* Move everything else up the array. I ought to use a
@@ -768,11 +768,11 @@
}
if (matches != 1 || index < 0)
- return FALSE;
+ return false;
pkey[j] = index;
}
- return TRUE;
+ return true;
}
static void flip_poly(struct solid *solid, int flip)
@@ -918,7 +918,7 @@
break;
}
if (v & j)
- SET_SQUARE(state, i, TRUE);
+ SET_SQUARE(state, i, true);
j >>= 1;
if (j == 0)
j = 8;
@@ -1007,7 +1007,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1715,7 +1715,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1738,7 +1738,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1745,8 +1745,8 @@
new_game,
dup_game,
free_game,
- FALSE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ false, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1763,8 +1763,8 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/divvy.c
+++ b/divvy.c
@@ -233,7 +233,7 @@
*/
if (neighbours[0] != val && neighbours[2] != val &&
neighbours[4] != val && neighbours[6] != val)
- return FALSE;
+ return false;
count = 0;
@@ -341,9 +341,9 @@
int dir;
if (curr < 0) {
- removable[yx] = FALSE; /* can't remove if not owned! */
+ removable[yx] = false; /* can't remove if not owned! */
} else if (sizes[curr] == 1) {
- removable[yx] = TRUE; /* can always remove a singleton */
+ removable[yx] = true; /* can always remove a singleton */
} else {
/*
* See if this square can be removed from its
--- a/dominosa.c
+++ b/dominosa.c
@@ -125,7 +125,7 @@
game_params *ret = snew(game_params);
ret->n = 6;
- ret->unique = TRUE;
+ ret->unique = true;
return ret;
}
@@ -144,7 +144,7 @@
case 4: n = 7; break;
case 5: n = 8; break;
case 6: n = 9; break;
- default: return FALSE;
+ default: return false;
}
sprintf(buf, "Up to double-%d", n);
@@ -152,9 +152,9 @@
*params = ret = snew(game_params);
ret->n = n;
- ret->unique = TRUE;
+ ret->unique = true;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -174,7 +174,7 @@
params->n = atoi(string);
while (*string && isdigit((unsigned char)*string)) string++;
if (*string == 'a')
- params->unique = FALSE;
+ params->unique = false;
}
static char *encode_params(const game_params *params, bool full)
@@ -352,7 +352,7 @@
#endif
while (1) {
- int done_something = FALSE;
+ int done_something = false;
/*
* For each domino, look at its possible placements, and
@@ -402,7 +402,7 @@
if (placements[j] != -2) {
int p1, p2, di;
- done_something = TRUE;
+ done_something = true;
/*
* Rule out this placement. First find what
@@ -491,7 +491,7 @@
for (k = heads[adi]; k >= 0; k = placements[k])
nn++;
if (nn > n) {
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
printf("considering square %d,%d: reducing placements "
"of domino %d\n", x, y, adi);
@@ -861,7 +861,7 @@
state->numbers->numbers[i] = j;
}
- state->completed = state->cheated = FALSE;
+ state->completed = state->cheated = false;
return state;
}
@@ -1191,7 +1191,7 @@
if (move[0] == 'S') {
int i;
- ret->cheated = TRUE;
+ ret->cheated = true;
/*
* Clear the existing edges and domino placements. We
@@ -1326,7 +1326,7 @@
sfree(used);
if (ok == DCOUNT(n))
- ret->completed = TRUE;
+ ret->completed = true;
}
return ret;
@@ -1398,7 +1398,7 @@
struct game_drawstate *ds = snew(struct game_drawstate);
int i;
- ds->started = FALSE;
+ ds->started = false;
ds->w = state->w;
ds->h = state->h;
ds->visible = snewn(ds->w * ds->h, unsigned long);
@@ -1569,7 +1569,7 @@
game_compute_size(&state->params, TILESIZE, &pw, &ph);
draw_rect(dr, 0, 0, pw, ph, COL_BACKGROUND);
draw_update(dr, 0, 0, pw, ph);
- ds->started = TRUE;
+ ds->started = true;
}
/*
@@ -1674,7 +1674,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1737,7 +1737,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1744,8 +1744,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1762,9 +1762,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/dsf.c
+++ b/dsf.c
@@ -93,7 +93,7 @@
void dsf_merge(int *dsf, int v1, int v2)
{
- edsf_merge(dsf, v1, v2, FALSE);
+ edsf_merge(dsf, v1, v2, false);
}
int dsf_size(int *dsf, int index) {
--- a/emcc.c
+++ b/emcc.c
@@ -171,17 +171,17 @@
/* ----------------------------------------------------------------------
* Timing functions.
*/
-int timer_active = FALSE;
+int timer_active = false;
void deactivate_timer(frontend *fe)
{
js_deactivate_timer();
- timer_active = FALSE;
+ timer_active = false;
}
void activate_timer(frontend *fe)
{
if (!timer_active) {
js_activate_timer();
- timer_active = TRUE;
+ timer_active = true;
}
}
void timer_callback(double tplus)
@@ -201,7 +201,7 @@
{
int w, h;
w = h = INT_MAX;
- midend_size(me, &w, &h, FALSE);
+ midend_size(me, &w, &h, false);
js_canvas_set_size(w, h);
canvas_w = w;
canvas_h = h;
@@ -210,7 +210,7 @@
/* Called from JS when the user uses the resize handle */
void resize_puzzle(int w, int h)
{
- midend_size(me, &w, &h, TRUE);
+ midend_size(me, &w, &h, true);
if (canvas_w != w || canvas_h != h) {
js_canvas_set_size(w, h);
canvas_w = w;
@@ -647,8 +647,8 @@
}
/*
- * Called when the user clicks OK or Cancel. use_results will be TRUE
- * or FALSE respectively, in those cases. We terminate the dialog box,
+ * Called when the user clicks OK or Cancel. use_results will be true
+ * or false respectively, in those cases. We terminate the dialog box,
* unless the user selected an invalid combination of parameters.
*/
static void cfg_end(int use_results)
@@ -738,11 +738,11 @@
}
break;
case 3: /* OK clicked in a config box */
- cfg_end(TRUE);
+ cfg_end(true);
update_undo_redo();
break;
case 4: /* Cancel clicked in a config box */
- cfg_end(FALSE);
+ cfg_end(false);
update_undo_redo();
break;
case 5: /* New Game */
@@ -833,11 +833,11 @@
{
struct savefile_read_ctx *ctx = (struct savefile_read_ctx *)vctx;
if (ctx->len_remaining < len)
- return FALSE;
+ return false;
memcpy(buf, ctx->buffer, len);
ctx->len_remaining -= len;
ctx->buffer += len;
- return TRUE;
+ return true;
}
void load_game(const char *buffer, int len)
@@ -916,7 +916,7 @@
if (thegame.can_configure)
js_add_preset(0, "Custom", -1);
- have_presets_dropdown = TRUE;
+ have_presets_dropdown = true;
/*
* Now ensure the appropriate element of the presets menu
--- a/fifteen.c
+++ b/fifteen.c
@@ -65,9 +65,9 @@
if (i == 0) {
*params = default_params();
*name = dupstr("4x4");
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
static void free_params(game_params *params)
@@ -172,12 +172,12 @@
for (i = 0; i < n; i++) {
tiles[i] = -1;
- used[i] = FALSE;
+ used[i] = false;
}
gap = random_upto(rs, n);
tiles[gap] = 0;
- used[0] = TRUE;
+ used[0] = true;
/*
* Place everything else except the last two tiles.
@@ -191,7 +191,7 @@
break;
assert(j < n && !used[j]);
- used[j] = TRUE;
+ used[j] = true;
while (tiles[x] >= 0)
x++;
@@ -283,7 +283,7 @@
used = snewn(area, int);
for (i = 0; i < area; i++)
- used[i] = FALSE;
+ used[i] = false;
for (i = 0; i < area; i++) {
const char *q = p;
@@ -312,7 +312,7 @@
err = "Number used twice";
goto leave;
}
- used[n] = TRUE;
+ used[n] = true;
if (*p) p++; /* eat comma */
}
@@ -350,7 +350,7 @@
assert(state->tiles[state->gap_pos] == 0);
state->completed = state->movecount = 0;
- state->used_solve = FALSE;
+ state->used_solve = false;
return state;
}
@@ -386,7 +386,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -657,7 +657,7 @@
}
if (next_piece == n)
- return FALSE;
+ return false;
/* 2, 3. Move the next piece towards its place */
@@ -680,7 +680,7 @@
*out_x = gx + dx;
*out_y = gy + dy;
- return TRUE;
+ return true;
}
static char *interpret_move(const game_state *state, game_ui *ui,
@@ -707,7 +707,7 @@
button = flip_cursor(button); /* the default */
if (invert_cursor)
button = flip_cursor(button); /* undoes the first flip */
- move_cursor(button, &nx, &ny, state->w, state->h, FALSE);
+ move_cursor(button, &nx, &ny, state->w, state->h, false);
} else if ((button == 'h' || button == 'H') && !state->completed) {
if (!compute_hint(state, &nx, &ny))
return NULL; /* shouldn't happen, since ^^we^^checked^^ */
@@ -746,7 +746,7 @@
for (i = 0; i < ret->n; i++)
ret->tiles[i] = (i+1) % ret->n;
ret->gap_pos = ret->n-1;
- ret->used_solve = TRUE;
+ ret->used_solve = true;
ret->completed = ret->movecount = 1;
return ret;
@@ -835,7 +835,7 @@
struct game_drawstate *ds = snew(struct game_drawstate);
int i;
- ds->started = FALSE;
+ ds->started = false;
ds->w = state->w;
ds->h = state->h;
ds->bgcolour = COL_BACKGROUND;
@@ -929,7 +929,7 @@
coords[0] = COORD(0) - HIGHLIGHT_WIDTH;
draw_polygon(dr, coords, 5, COL_LOWLIGHT, COL_LOWLIGHT);
- ds->started = TRUE;
+ ds->started = true;
}
/*
@@ -1067,7 +1067,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1090,7 +1090,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1097,8 +1097,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1115,9 +1115,9 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
@@ -1129,7 +1129,7 @@
game_state *state;
char *id = NULL, *desc;
const char *err;
- int grade = FALSE;
+ int grade = false;
char *progname = argv[0];
char buf[80];
@@ -1138,9 +1138,9 @@
while (--argc > 0) {
char *p = *++argv;
if (!strcmp(p, "-v")) {
- /* solver_show_working = TRUE; */
+ /* solver_show_working = true; */
} else if (!strcmp(p, "-g")) {
- grade = TRUE;
+ grade = true;
} else if (*p == '-') {
fprintf(stderr, "%s: unrecognised option `%s'\n", progname, p);
return 1;
--- a/filling.c
+++ b/filling.c
@@ -116,13 +116,13 @@
{
char buf[64];
- if (i < 0 || i >= lenof(filling_defaults)) return FALSE;
+ if (i < 0 || i >= lenof(filling_defaults)) return false;
*params = snew(game_params);
**params = filling_defaults[i]; /* struct copy */
sprintf(buf, "%dx%d", filling_defaults[i].w, filling_defaults[i].h);
*name = dupstr(buf);
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -270,7 +270,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -320,11 +320,11 @@
for (j = 0; j < 4; ++j) {
const int x = (i % w) + dx[j], y = (i / w) + dy[j], ii = w*y + x;
if (x < 0 || x >= w || y < 0 || y >= h) continue;
- if (board[ii] == m) return FALSE;
+ if (board[ii] == m) return false;
if (board[ii] != n) continue;
- if (!mark_region(board, w, h, ii, n, m)) return FALSE;
+ if (!mark_region(board, w, h, ii, n, m)) return false;
}
- return TRUE;
+ return true;
}
static int region_size(int *board, int w, int h, int i) {
@@ -347,7 +347,7 @@
const int maxsize = min(max(max(w, h), 3), 9);
int i, j, k, change;
do {
- change = FALSE;
+ change = false;
for (i = 0; i < sz; ++i) {
if (board[i] != 1) continue;
@@ -371,7 +371,7 @@
if (ok) break;
}
- if (j < 4) change = TRUE;
+ if (j < 4) change = true;
}
} while (change);
}
@@ -403,11 +403,11 @@
shuffle(board, sz, sizeof (int), rs);
do {
- change = FALSE; /* as long as the board potentially has errors */
+ change = false; /* as long as the board potentially has errors */
for (i = 0; i < sz; ++i) {
const int square = dsf_canonify(dsf, board[i]);
const int size = dsf_size(dsf, square);
- int merge = SENTINEL, min = maxsize - size + 1, error = FALSE;
+ int merge = SENTINEL, min = maxsize - size + 1, error = false;
int neighbour, neighbour_size, j;
for (j = 0; j < 4; ++j) {
@@ -419,7 +419,7 @@
if (square == neighbour) continue;
neighbour_size = dsf_size(dsf, neighbour);
- if (size == neighbour_size) error = TRUE;
+ if (size == neighbour_size) error = true;
/* find the smallest neighbour to merge with, which
* wouldn't make the region too large. (This is
@@ -441,7 +441,7 @@
/* merge with the smallest neighbouring workable region. */
dsf_merge(dsf, square, merge);
- change = TRUE;
+ change = true;
}
} while (change);
@@ -628,13 +628,13 @@
static int learn_expand_or_one(struct solver_state *s, int w, int h) {
const int sz = w * h;
int i;
- int learn = FALSE;
+ int learn = false;
assert(s);
for (i = 0; i < sz; ++i) {
int j;
- int one = TRUE;
+ int one = true;
if (s->board[i] != EMPTY) continue;
@@ -644,7 +644,7 @@
const int idx = w*y + x;
if (x < 0 || x >= w || y < 0 || y >= h) continue;
if (s->board[idx] == EMPTY) {
- one = FALSE;
+ one = false;
continue;
}
if (one &&
@@ -651,7 +651,7 @@
(s->board[idx] == 1 ||
(s->board[idx] >= expandsize(s->board, s->dsf, w, h,
i, s->board[idx]))))
- one = FALSE;
+ one = false;
if (dsf_size(s->dsf, idx) == s->board[idx]) continue;
assert(s->board[i] == EMPTY);
s->board[i] = -SENTINEL;
@@ -659,7 +659,7 @@
assert(s->board[i] == EMPTY);
printv("learn: expanding in one\n");
expand(s, w, h, i, idx);
- learn = TRUE;
+ learn = true;
break;
}
@@ -669,7 +669,7 @@
s->board[i] = 1;
assert(s->nempty);
--s->nempty;
- learn = TRUE;
+ learn = true;
}
}
return learn;
@@ -678,7 +678,7 @@
static int learn_blocked_expansion(struct solver_state *s, int w, int h) {
const int sz = w * h;
int i;
- int learn = FALSE;
+ int learn = false;
assert(s);
/* for every connected component */
@@ -758,7 +758,7 @@
if (exp == SENTINEL) continue;
printv("learning to expand\n");
expand(s, w, h, exp, i);
- learn = TRUE;
+ learn = true;
next_i:
;
@@ -770,7 +770,7 @@
static int learn_critical_square(struct solver_state *s, int w, int h) {
const int sz = w * h;
int i;
- int learn = FALSE;
+ int learn = false;
assert(s);
/* for each connected component */
@@ -804,7 +804,7 @@
--s->nempty;
s->board[j] = s->board[i];
filled_square(s, w, h, j);
- learn = TRUE;
+ learn = true;
}
}
return learn;
@@ -831,7 +831,7 @@
int *dsf = s->bmdsf;
int *minsize = s->bmminsize;
int x, y, i, j, n;
- int learn = FALSE;
+ int learn = false;
/*
* This function does deductions based on building up a bitmap
@@ -1058,7 +1058,7 @@
filled_square(s, w, h, i);
assert(s->nempty);
--s->nempty;
- learn = TRUE;
+ learn = true;
}
}
}
@@ -1312,7 +1312,7 @@
int sz = params->w * params->h;
int i;
- state->cheated = state->completed = FALSE;
+ state->cheated = state->completed = false;
state->shared = snew(struct shared_state);
state->shared->refcnt = 1;
state->shared->params = *params; /* struct copy */
@@ -1412,7 +1412,7 @@
sfree(ui->sel);
ui->sel = NULL;
}
- ui->keydragging = FALSE;
+ ui->keydragging = false;
}
#define PREFERRED_TILE_SIZE 32
@@ -1498,7 +1498,7 @@
ui->sel = snewn(w*h, int);
memset(ui->sel, 0, w*h*sizeof(int));
}
- ui->keydragging = FALSE;
+ ui->keydragging = false;
if (!state->shared->clues[w*ui->cur_y + ui->cur_x])
ui->sel[w*ui->cur_y + ui->cur_x] ^= 1;
for (i = 0; i < w*h && !ui->sel[i]; i++);
@@ -1512,7 +1512,7 @@
if (button == '\b' || button == 27) {
sfree(ui->sel);
ui->sel = NULL;
- ui->keydragging = FALSE;
+ ui->keydragging = false;
return UI_UPDATE;
}
@@ -1519,7 +1519,7 @@
if (button < '0' || button > '9') return NULL;
button -= '0';
if (button > (w == 2 && h == 2 ? 3 : max(w, h))) return NULL;
- ui->keydragging = FALSE;
+ ui->keydragging = false;
for (i = 0; i < w*h; i++) {
char buf[32];
@@ -1560,7 +1560,7 @@
int i = 0;
new_state = dup_game(state);
for (++move; i < sz; ++i) new_state->board[i] = move[i] - '0';
- new_state->cheated = TRUE;
+ new_state->cheated = true;
} else {
int value;
char *endptr, *delim = strchr(move, '_');
@@ -1592,7 +1592,7 @@
for (i = 0; i < sz && new_state->board[i] == dsf_size(dsf, i); ++i);
sfree(dsf);
if (i == sz)
- new_state->completed = TRUE;
+ new_state->completed = true;
}
return new_state;
@@ -1862,7 +1862,7 @@
int v1, s1, v2, s2;
for (dx = 0; dx <= 1; dx++) {
- int border = FALSE;
+ int border = false;
dy = 1 - dx;
@@ -1885,7 +1885,7 @@
* contain actual numbers...
*/
if (v1 && v2)
- border = TRUE;
+ border = true;
/*
* ... or if at least one of them is a
@@ -1892,9 +1892,9 @@
* completed or overfull omino.
*/
if (v1 && s1 >= v1)
- border = TRUE;
+ border = true;
if (v2 && s2 >= v2)
- border = TRUE;
+ border = true;
}
if (border)
@@ -2025,10 +2025,10 @@
draw_update(dr, 0, 0, w*TILE_SIZE + 2*BORDER, h*TILE_SIZE + 2*BORDER);
- ds->started = TRUE;
+ ds->started = true;
}
- draw_grid(dr, ds, state, ui, flashy, TRUE, TRUE);
+ draw_grid(dr, ds, state, ui, flashy, true, true);
}
static float game_anim_length(const game_state *oldstate,
@@ -2057,7 +2057,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2101,16 +2101,16 @@
* We'll draw borders between the ominoes iff the grid is not
* pristine. So scan it to see if it is.
*/
- borders = FALSE;
+ borders = false;
for (i = 0; i < w*h; i++)
if (state->board[i] && !state->shared->clues[i])
- borders = TRUE;
+ borders = true;
/*
* Draw grid.
*/
print_line_width(dr, TILE_SIZE / 64);
- draw_grid(dr, ds, state, NULL, FALSE, borders, FALSE);
+ draw_grid(dr, ds, state, NULL, false, borders, false);
/*
* Clean up.
@@ -2130,7 +2130,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2137,8 +2137,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2155,9 +2155,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_NUMPAD, /* flags */
};
--- a/findloop.c
+++ b/findloop.c
@@ -80,7 +80,7 @@
pv[v].parent = root;
pv[v].child = -2;
pv[v].sibling = -1;
- pv[v].visited = FALSE;
+ pv[v].visited = false;
}
pv[root].child = -1;
nedges = 0;
@@ -98,7 +98,7 @@
u = v;
while (1) {
if (!pv[u].visited) {
- pv[u].visited = TRUE;
+ pv[u].visited = true;
/*
* Enumerate the neighbours of u, and any that are
@@ -169,12 +169,12 @@
debug(("--- begin indexing pass\n"));
index = 0;
for (v = 0; v < nvertices; v++)
- pv[v].visited = FALSE;
- pv[root].visited = TRUE;
+ pv[v].visited = false;
+ pv[root].visited = true;
u = pv[root].child;
while (1) {
if (!pv[u].visited) {
- pv[u].visited = TRUE;
+ pv[u].visited = true;
/*
* Index this node.
@@ -239,12 +239,12 @@
debug(("--- begin min-max pass\n"));
nbridges = 0;
for (v = 0; v < nvertices; v++)
- pv[v].visited = FALSE;
+ pv[v].visited = false;
u = pv[root].child;
- pv[root].visited = TRUE;
+ pv[root].visited = true;
while (1) {
if (!pv[u].visited) {
- pv[u].visited = TRUE;
+ pv[u].visited = true;
/*
* Look for vertices reachable directly from u, including
--- a/flip.c
+++ b/flip.c
@@ -88,7 +88,7 @@
char str[80];
if (i < 0 || i >= lenof(flip_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = flip_presets[i];
@@ -98,7 +98,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -619,9 +619,9 @@
state->w = w;
state->h = h;
- state->completed = FALSE;
- state->cheated = FALSE;
- state->hints_active = FALSE;
+ state->completed = false;
+ state->cheated = false;
+ state->hints_active = false;
state->moves = 0;
state->matrix = snew(struct matrix);
state->matrix->refcount = 1;
@@ -852,7 +852,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
#define RIGHT 1
@@ -955,10 +955,10 @@
* will have at least one square do nothing whatsoever.
* If so, we avoid encoding a move at all.
*/
- int i = ty*w+tx, j, makemove = FALSE;
+ int i = ty*w+tx, j, makemove = false;
for (j = 0; j < wh; j++) {
if (state->matrix->matrix[i*wh+j])
- makemove = TRUE;
+ makemove = true;
}
if (makemove) {
sprintf(buf, "M%d,%d", tx, ty);
@@ -997,8 +997,8 @@
int i;
ret = dup_game(from);
- ret->hints_active = TRUE;
- ret->cheated = TRUE;
+ ret->hints_active = true;
+ ret->cheated = true;
for (i = 0; i < wh; i++) {
ret->grid[i] &= ~2;
if (move[i+1] != '0')
@@ -1017,16 +1017,16 @@
i = y * w + x;
- done = TRUE;
+ done = true;
for (j = 0; j < wh; j++) {
ret->grid[j] ^= ret->matrix->matrix[i*wh+j];
if (ret->grid[j] & 1)
- done = FALSE;
+ done = false;
}
ret->grid[i] ^= 2; /* toggle hint */
if (done) {
- ret->completed = TRUE;
- ret->hints_active = FALSE;
+ ret->completed = true;
+ ret->hints_active = false;
}
return ret;
@@ -1094,7 +1094,7 @@
struct game_drawstate *ds = snew(struct game_drawstate);
int i;
- ds->started = FALSE;
+ ds->started = false;
ds->w = state->w;
ds->h = state->h;
ds->tiles = snewn(ds->w*ds->h, unsigned char);
@@ -1214,7 +1214,7 @@
draw_update(dr, 0, 0, TILE_SIZE * w + 2 * BORDER,
TILE_SIZE * h + 2 * BORDER);
- ds->started = TRUE;
+ ds->started = true;
}
if (flashtime)
@@ -1291,7 +1291,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1314,7 +1314,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1321,8 +1321,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1339,8 +1339,8 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/flood.c
+++ b/flood.c
@@ -106,13 +106,13 @@
game_params *ret;
if (i < 0 || i >= lenof(flood_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = flood_presets[i].preset;
*name = dupstr(flood_presets[i].name);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -448,9 +448,9 @@
for (i = 1; i < wh; i++)
if (grid[i] != grid[0])
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
/*
@@ -642,8 +642,8 @@
desc++;
state->movelimit = atoi(desc);
- state->complete = FALSE;
- state->cheated = FALSE;
+ state->complete = false;
+ state->cheated = false;
state->solnpos = 0;
state->soln = NULL;
@@ -731,7 +731,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -768,7 +768,7 @@
static game_ui *new_ui(const game_state *state)
{
struct game_ui *ui = snew(struct game_ui);
- ui->cursor_visible = FALSE;
+ ui->cursor_visible = false;
ui->cx = FILLX;
ui->cy = FILLY;
return ui;
@@ -820,22 +820,22 @@
if (button == LEFT_BUTTON) {
tx = FROMCOORD(x);
ty = FROMCOORD(y);
- ui->cursor_visible = FALSE;
+ ui->cursor_visible = false;
} else if (button == CURSOR_LEFT && ui->cx > 0) {
ui->cx--;
- ui->cursor_visible = TRUE;
+ ui->cursor_visible = true;
return UI_UPDATE;
} else if (button == CURSOR_RIGHT && ui->cx+1 < w) {
ui->cx++;
- ui->cursor_visible = TRUE;
+ ui->cursor_visible = true;
return UI_UPDATE;
} else if (button == CURSOR_UP && ui->cy > 0) {
ui->cy--;
- ui->cursor_visible = TRUE;
+ ui->cursor_visible = true;
return UI_UPDATE;
} else if (button == CURSOR_DOWN && ui->cy+1 < h) {
ui->cy++;
- ui->cursor_visible = TRUE;
+ ui->cursor_visible = true;
return UI_UPDATE;
} else if (button == CURSOR_SELECT) {
tx = ui->cx;
@@ -928,7 +928,7 @@
}
ret = dup_game(state);
- ret->cheated = TRUE;
+ ret->cheated = true;
if (ret->soln && --ret->soln->refcount == 0) {
sfree(ret->soln->moves);
sfree(ret->soln);
@@ -1033,7 +1033,7 @@
int w = state->w, h = state->h, wh = w*h;
int i;
- ds->started = FALSE;
+ ds->started = false;
ds->tilesize = 0;
ds->grid = snewn(wh, int);
for (i = 0; i < wh; i++)
@@ -1312,7 +1312,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1335,7 +1335,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1342,8 +1342,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1360,8 +1360,8 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/galaxies.c
+++ b/galaxies.c
@@ -177,7 +177,7 @@
char buf[80];
if (i < 0 || i >= lenof(galaxies_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = galaxies_presets[i]; /* structure copy */
@@ -187,7 +187,7 @@
if (name) *name = dupstr(buf);
*params = ret;
- return TRUE;
+ return true;
}
static game_params *default_params(void)
@@ -386,7 +386,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1310,7 +1310,7 @@
for (i = 0; i < state->sx*state->sy; i++)
if (state->grid[i].type == s_tile)
- outline_tile_fordot(state, &state->grid[i], TRUE);
+ outline_tile_fordot(state, &state->grid[i], true);
cc = check_complete(state, NULL, NULL);
assert(cc);
@@ -1412,7 +1412,7 @@
cy0 = ((cy+1) & ~1) - 1;
cx1 = 2*cx-cx0; /* and reflect about cx to get cx1 */
cy1 = 2*cy-cy0;
- ok = TRUE;
+ ok = true;
for (ty = cy0; ty <= cy1; ty += 2)
for (tx = cx0; tx <= cx1; tx += 2) {
ts = &SPACE(state, tx, ty);
@@ -1419,7 +1419,7 @@
assert(ts->type == s_tile);
if ((ts->dotx != d0->x || ts->doty != d0->y) &&
(ts->dotx != d1->x || ts->doty != d1->y))
- ok = FALSE;
+ ok = false;
}
if (!ok)
continue;
@@ -1441,13 +1441,13 @@
tx1 = 2*cx-tx;
ty1 = 2*cy-ty;
if (!INGRID(state, tx1, ty1)) {
- ok = FALSE;
+ ok = false;
break;
}
ts = &SPACE(state, cx+cx-tx, cy+cy-ty);
if ((ts->dotx != d0->x || ts->doty != d0->y) &&
(ts->dotx != d1->x || ts->doty != d1->y)) {
- ok = FALSE;
+ ok = false;
break;
}
}
@@ -2308,7 +2308,7 @@
static game_ui *new_ui(const game_state *state)
{
game_ui *ui = snew(game_ui);
- ui->dragging = FALSE;
+ ui->dragging = false;
ui->cur_x = ui->cur_y = 1;
ui->cur_visible = 0;
return ui;
@@ -2545,7 +2545,7 @@
* Now, if we've managed to find a dot, begin a drag.
*/
if (dot) {
- ui->dragging = TRUE;
+ ui->dragging = true;
ui->dx = x;
ui->dy = y;
ui->dotx = dot->x;
@@ -2558,7 +2558,7 @@
ui->dy = y;
return UI_UPDATE;
} else if (button == RIGHT_RELEASE && ui->dragging) {
- ui->dragging = FALSE;
+ ui->dragging = false;
/*
* Drags are always targeted at a single square.
@@ -2616,7 +2616,7 @@
}
sp = &SPACE(state, ui->cur_x, ui->cur_y);
if (ui->dragging) {
- ui->dragging = FALSE;
+ ui->dragging = false;
if ((ui->srcx != ui->dotx || ui->srcy != ui->doty) &&
SPACE(state, ui->srcx, ui->srcy).flags & F_TILE_ASSOC) {
@@ -2629,7 +2629,7 @@
}
return dupstr(buf);
} else if (sp->flags & F_DOT) {
- ui->dragging = TRUE;
+ ui->dragging = true;
ui->dx = SCOORD(ui->cur_x);
ui->dy = SCOORD(ui->cur_y);
ui->dotx = ui->srcx = ui->cur_x;
@@ -2637,7 +2637,7 @@
return UI_UPDATE;
} else if (sp->flags & F_TILE_ASSOC) {
assert(sp->type == s_tile);
- ui->dragging = TRUE;
+ ui->dragging = true;
ui->dx = SCOORD(ui->cur_x);
ui->dy = SCOORD(ui->cur_y);
ui->dotx = sp->dotx;
@@ -2669,10 +2669,10 @@
if (!dsf) {
dsf = snew_dsf(w*h);
- free_dsf = TRUE;
+ free_dsf = true;
} else {
dsf_init(dsf, w*h);
- free_dsf = FALSE;
+ free_dsf = false;
}
/*
@@ -2711,7 +2711,7 @@
sqdata[i].minx = w+1;
sqdata[i].miny = h+1;
sqdata[i].maxx = sqdata[i].maxy = -1;
- sqdata[i].valid = FALSE;
+ sqdata[i].valid = false;
}
for (y = 0; y < h; y++)
for (x = 0; x < w; x++) {
@@ -2724,7 +2724,7 @@
sqdata[i].miny = y;
if (sqdata[i].maxy < y)
sqdata[i].maxy = y;
- sqdata[i].valid = TRUE;
+ sqdata[i].valid = true;
}
/*
@@ -2738,12 +2738,12 @@
cx = sqdata[i].cx = sqdata[i].minx + sqdata[i].maxx + 1;
cy = sqdata[i].cy = sqdata[i].miny + sqdata[i].maxy + 1;
if (!(SPACE(state, sqdata[i].cx, sqdata[i].cy).flags & F_DOT))
- sqdata[i].valid = FALSE; /* no dot at centre of symmetry */
+ sqdata[i].valid = false; /* no dot at centre of symmetry */
if (dsf_canonify(dsf, (cy-1)/2*w+(cx-1)/2) != i ||
dsf_canonify(dsf, (cy)/2*w+(cx-1)/2) != i ||
dsf_canonify(dsf, (cy-1)/2*w+(cx)/2) != i ||
dsf_canonify(dsf, (cy)/2*w+(cx)/2) != i)
- sqdata[i].valid = FALSE; /* dot at cx,cy isn't ours */
+ sqdata[i].valid = false; /* dot at cx,cy isn't ours */
if (SPACE(state, sqdata[i].cx, sqdata[i].cy).flags & F_DOT_BLACK)
sqdata[i].colour = 2;
else
@@ -2773,7 +2773,7 @@
for (cx = (x-1) >> 1; cx <= x >> 1; cx++) {
i = dsf_canonify(dsf, cy*w+cx);
if (x != sqdata[i].cx || y != sqdata[i].cy)
- sqdata[i].valid = FALSE;
+ sqdata[i].valid = false;
}
}
@@ -2787,7 +2787,7 @@
assert((cx1==cx2) ^ (cy1==cy2));
i = dsf_canonify(dsf, cy1*w+cx1);
if (i == dsf_canonify(dsf, cy2*w+cx2))
- sqdata[i].valid = FALSE;
+ sqdata[i].valid = false;
}
}
@@ -2806,7 +2806,7 @@
x2 = sqdata[i].cx - 1 - x;
y2 = sqdata[i].cy - 1 - y;
if (i != dsf_canonify(dsf, y2*w+x2))
- sqdata[i].valid = FALSE;
+ sqdata[i].valid = false;
}
/*
@@ -2816,7 +2816,7 @@
* true/false value depending on whether _every_ square in the
* grid is part of a valid component.
*/
- ret = TRUE;
+ ret = true;
for (i = 0; i < w*h; i++) {
int ci = dsf_canonify(dsf, i);
int thisok = sqdata[ci].valid;
@@ -2837,7 +2837,7 @@
int x, y, ax, ay, n, dx, dy;
game_state *ret = dup_game(state);
space *sp, *dot;
- int currently_solving = FALSE;
+ int currently_solving = false;
debug(("%s\n", move));
@@ -2929,7 +2929,7 @@
} else if (c == 'S') {
move++;
ret->used_solve = 1;
- currently_solving = TRUE;
+ currently_solving = true;
} else
goto badmove;
@@ -3063,7 +3063,7 @@
ds->bl = NULL;
ds->blmirror = NULL;
- ds->dragging = FALSE;
+ ds->dragging = false;
ds->dragx = ds->dragy = 0;
ds->colour_scratch = snewn(ds->w * ds->h, int);
@@ -3221,7 +3221,7 @@
float animtime, float flashtime)
{
int w = ds->w, h = ds->h;
- int x, y, flashing = FALSE;
+ int x, y, flashing = false;
int oppx, oppy;
if (flashtime > 0) {
@@ -3240,13 +3240,13 @@
draw_update(dr, ds->dragx, ds->dragy, TILE_SIZE, TILE_SIZE);
blitter_load(dr, ds->blmirror, oppx, oppy);
draw_update(dr, oppx, oppy, TILE_SIZE, TILE_SIZE);
- ds->dragging = FALSE;
+ ds->dragging = false;
}
if (ds->cur_visible) {
assert(ds->cur_bl);
blitter_load(dr, ds->cur_bl, ds->cx, ds->cy);
draw_update(dr, ds->cx, ds->cy, CURSOR_SIZE*2+1, CURSOR_SIZE*2+1);
- ds->cur_visible = FALSE;
+ ds->cur_visible = false;
}
if (!ds->started) {
@@ -3255,7 +3255,7 @@
w*TILE_SIZE + EDGE_THICKNESS*2 - 1,
h*TILE_SIZE + EDGE_THICKNESS*2 - 1, COL_EDGE);
draw_update(dr, 0, 0, DRAW_WIDTH, DRAW_HEIGHT);
- ds->started = TRUE;
+ ds->started = true;
}
check_complete(state, NULL, ds->colour_scratch);
@@ -3377,7 +3377,7 @@
*/
if (ui->cur_visible) {
space *sp = &SPACE(state, ui->cur_x, ui->cur_y);
- ds->cur_visible = TRUE;
+ ds->cur_visible = true;
ds->cx = SCOORD(ui->cur_x) - CURSOR_SIZE;
ds->cy = SCOORD(ui->cur_y) - CURSOR_SIZE;
blitter_save(dr, ds->cur_bl, ds->cx, ds->cy);
@@ -3398,7 +3398,7 @@
}
if (ui->dragging) {
- ds->dragging = TRUE;
+ ds->dragging = true;
ds->dragx = ui->dx - TILE_SIZE/2;
ds->dragy = ui->dy - TILE_SIZE/2;
calculate_opposite_point(ui, ds, ui->dx, ui->dy, &oppx, &oppy);
@@ -3444,7 +3444,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
#ifndef EDITOR
@@ -3635,7 +3635,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -3643,11 +3643,11 @@
dup_game,
free_game,
#ifdef EDITOR
- FALSE, NULL,
+ false, NULL,
#else
- TRUE, solve_game,
+ true, solve_game,
#endif
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -3665,13 +3665,13 @@
game_flash_length,
game_status,
#ifdef EDITOR
- FALSE, FALSE, NULL, NULL,
- TRUE, /* wants_statusbar */
+ false, false, NULL, NULL,
+ true, /* wants_statusbar */
#else
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
#endif
- FALSE, game_timing_state,
+ false, game_timing_state,
REQUIRE_RBUTTON, /* flags */
};
@@ -3977,8 +3977,8 @@
rs = random_new((void*)&seed, sizeof(time_t));
- desc = new_game_desc(par, rs, NULL, FALSE);
- params = encode_params(par, FALSE);
+ desc = new_game_desc(par, rs, NULL, false);
+ params = encode_params(par, false);
printf("%s:%s\n", params, desc);
sfree(desc);
--- a/grid.c
+++ b/grid.c
@@ -386,11 +386,11 @@
*/
dots = snewn(g->num_dots, int);
for (i = 0; i < g->num_dots; i++) {
- dots[i] = TRUE;
+ dots[i] = true;
for (j = 0; j < g->num_dots; j++) {
if ((dotpairs[i*g->num_dots+j] >= 0) ^
(dotpairs[j*g->num_dots+i] >= 0))
- dots[i] = FALSE; /* non-duplicated edge: coastal dot */
+ dots[i] = false; /* non-duplicated edge: coastal dot */
}
}
@@ -435,14 +435,14 @@
dots[i] = 0;
for (i = 0; i < g->num_faces; i++) {
grid_face *f = g->faces + i;
- int keep = FALSE;
+ int keep = false;
for (k = 0; k < f->order; k++)
if (dsf_canonify(dsf, f->dots[k] - g->dots) == j)
- keep = TRUE;
+ keep = true;
if (keep) {
- faces[i] = TRUE;
+ faces[i] = true;
for (k = 0; k < f->order; k++)
- dots[f->dots[k]-g->dots] = TRUE;
+ dots[f->dots[k]-g->dots] = true;
}
}
@@ -700,7 +700,7 @@
* that face (see diagram). */
/* clockwise search */
- while (TRUE) {
+ while (true) {
grid_face *f = d->faces[current_face1];
grid_edge *e;
int j;
@@ -737,7 +737,7 @@
continue; /* this dot is complete, move on to next dot */
/* anticlockwise search */
- while (TRUE) {
+ while (true) {
grid_face *f = d->faces[current_face2];
grid_edge *e;
int j;
@@ -813,7 +813,7 @@
for (i = 0; i < face_size; i++)
new_face->dots[i] = NULL;
new_face->edges = NULL;
- new_face->has_incentre = FALSE;
+ new_face->has_incentre = false;
g->num_faces++;
}
/* Assumes dot list has enough space */
@@ -868,7 +868,7 @@
double det;
det = (mx[0]*mx[3] - mx[1]*mx[2]);
if (det == 0)
- return FALSE;
+ return false;
inv[0] = mx[3] / det;
inv[1] = -mx[1] / det;
@@ -878,7 +878,7 @@
vout[0] = inv[0]*vin[0] + inv[1]*vin[1];
vout[1] = inv[2]*vin[0] + inv[3]*vin[1];
- return TRUE;
+ return true;
}
static int solve_3x3_matrix(double mx[9], double vin[3], double vout[3])
{
@@ -888,7 +888,7 @@
det = (mx[0]*mx[4]*mx[8] + mx[1]*mx[5]*mx[6] + mx[2]*mx[3]*mx[7] -
mx[0]*mx[5]*mx[7] - mx[1]*mx[3]*mx[8] - mx[2]*mx[4]*mx[6]);
if (det == 0)
- return FALSE;
+ return false;
inv[0] = (mx[4]*mx[8] - mx[5]*mx[7]) / det;
inv[1] = (mx[2]*mx[7] - mx[1]*mx[8]) / det;
@@ -904,7 +904,7 @@
vout[1] = inv[3]*vin[0] + inv[4]*vin[1] + inv[5]*vin[2];
vout[2] = inv[6]*vin[0] + inv[7]*vin[1] + inv[8]*vin[2];
- return TRUE;
+ return true;
}
void grid_find_incentre(grid_face *f)
@@ -1364,7 +1364,7 @@
assert(bestdist > 0);
- f->has_incentre = TRUE;
+ f->has_incentre = true;
f->ix = xbest + 0.5; /* round to nearest */
f->iy = ybest + 0.5;
}
@@ -1611,11 +1611,11 @@
f1->edges = NULL;
f1->order = 3;
f1->dots = snewn(f1->order, grid_dot*);
- f1->has_incentre = FALSE;
+ f1->has_incentre = false;
f2->edges = NULL;
f2->order = 3;
f2->dots = snewn(f2->order, grid_dot*);
- f2->has_incentre = FALSE;
+ f2->has_incentre = false;
/* face descriptions depend on whether the row-number is
* odd or even */
--- a/gtk.c
+++ b/gtk.c
@@ -359,7 +359,7 @@
fe->background.red = fe->colours[3*colour + 0] * 65535;
fe->background.green = fe->colours[3*colour + 1] * 65535;
fe->background.blue = fe->colours[3*colour + 2] * 65535;
- if (!gdk_colormap_alloc_color(colmap, &fe->background, FALSE, FALSE)) {
+ if (!gdk_colormap_alloc_color(colmap, &fe->background, false, false)) {
g_error("couldn't allocate background (#%02x%02x%02x)\n",
fe->background.red >> 8, fe->background.green >> 8,
fe->background.blue >> 8);
@@ -511,9 +511,9 @@
fe->image = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
fe->pw, fe->ph);
- wipe_and_maybe_destroy_cairo(fe, cairo_create(fe->image), TRUE);
+ wipe_and_maybe_destroy_cairo(fe, cairo_create(fe->image), true);
#ifndef USE_CAIRO_WITHOUT_PIXMAP
- wipe_and_maybe_destroy_cairo(fe, gdk_cairo_create(fe->pixmap), TRUE);
+ wipe_and_maybe_destroy_cairo(fe, gdk_cairo_create(fe->pixmap), true);
#endif
#if GTK_CHECK_VERSION(3,22,0)
{
@@ -526,13 +526,13 @@
region = gdk_window_get_clip_region(gdkwin);
drawctx = gdk_window_begin_draw_frame(gdkwin, region);
cr = gdk_drawing_context_get_cairo_context(drawctx);
- wipe_and_maybe_destroy_cairo(fe, cr, FALSE);
+ wipe_and_maybe_destroy_cairo(fe, cr, false);
gdk_window_end_draw_frame(gdkwin, drawctx);
cairo_region_destroy(region);
}
#else
wipe_and_maybe_destroy_cairo(
- fe, gdk_cairo_create(gtk_widget_get_window(fe->area)), TRUE);
+ fe, gdk_cairo_create(gtk_widget_get_window(fe->area)), true);
#endif
}
@@ -586,7 +586,7 @@
}
success = snewn(ncolours, gboolean);
gdk_colormap_alloc_colors(fe->colmap, fe->colours, ncolours,
- FALSE, FALSE, success);
+ false, false, success);
for (i = 0; i < ncolours; i++) {
if (!success[i]) {
g_error("couldn't allocate colour %d (#%02x%02x%02x)\n",
@@ -698,7 +698,7 @@
if (fillcolour >= 0) {
set_colour(fe, fillcolour);
- gdk_draw_polygon(fe->pixmap, fe->gc, TRUE, points, npoints);
+ gdk_draw_polygon(fe->pixmap, fe->gc, true, points, npoints);
}
assert(outlinecolour >= 0);
set_colour(fe, outlinecolour);
@@ -722,7 +722,7 @@
{
if (fillcolour >= 0) {
set_colour(fe, fillcolour);
- gdk_draw_arc(fe->pixmap, fe->gc, TRUE,
+ gdk_draw_arc(fe->pixmap, fe->gc, true,
cx - radius, cy - radius,
2 * radius, 2 * radius, 0, 360 * 64);
}
@@ -729,7 +729,7 @@
assert(outlinecolour >= 0);
set_colour(fe, outlinecolour);
- gdk_draw_arc(fe->pixmap, fe->gc, FALSE,
+ gdk_draw_arc(fe->pixmap, fe->gc, false,
cx - radius, cy - radius,
2 * radius, 2 * radius, 0, 360 * 64);
}
@@ -812,24 +812,24 @@
#endif
if (x < fe->ox) {
gdk_draw_rectangle(gtk_widget_get_window(widget), gc,
- TRUE, x, y, fe->ox - x, h);
+ true, x, y, fe->ox - x, h);
w -= (fe->ox - x);
x = fe->ox;
}
if (y < fe->oy) {
gdk_draw_rectangle(gtk_widget_get_window(widget), gc,
- TRUE, x, y, w, fe->oy - y);
+ true, x, y, w, fe->oy - y);
h -= (fe->oy - y);
y = fe->oy;
}
if (w > fe->pw) {
gdk_draw_rectangle(gtk_widget_get_window(widget), gc,
- TRUE, x + fe->pw, y, w - fe->pw, h);
+ true, x + fe->pw, y, w - fe->pw, h);
w = fe->pw;
}
if (h > fe->ph) {
gdk_draw_rectangle(gtk_widget_get_window(widget), gc,
- TRUE, x, y + fe->ph, w, h - fe->ph);
+ true, x, y + fe->ph, w, h - fe->ph);
h = fe->ph;
}
gdk_draw_pixmap(gtk_widget_get_window(widget), gc, fe->pixmap,
@@ -1190,11 +1190,11 @@
int ctrl = (event->state & GDK_CONTROL_MASK) ? MOD_CTRL : 0;
if (!backing_store_ok(fe))
- return TRUE;
+ return true;
/* Handle mnemonics. */
if (gtk_window_activate_key(GTK_WINDOW(fe->window), event))
- return TRUE;
+ return true;
if (event->keyval == GDK_KEY_Up)
keyval = shift | ctrl | CURSOR_UP;
@@ -1249,7 +1249,7 @@
!midend_process_key(fe->me, 0, 0, keyval))
gtk_widget_destroy(fe->window);
- return TRUE;
+ return true;
}
static gint button_event(GtkWidget *widget, GdkEventButton *event,
@@ -1259,10 +1259,10 @@
int button;
if (!backing_store_ok(fe))
- return TRUE;
+ return true;
if (event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE)
- return TRUE;
+ return true;
if (event->button == 2 || (event->state & GDK_SHIFT_MASK))
button = MIDDLE_BUTTON;
@@ -1275,7 +1275,7 @@
else if (event->button == 9 && event->type == GDK_BUTTON_PRESS)
button = 'r';
else
- return FALSE; /* don't even know what button! */
+ return false; /* don't even know what button! */
if (event->type == GDK_BUTTON_RELEASE && button >= LEFT_BUTTON)
button += LEFT_RELEASE - LEFT_BUTTON;
@@ -1284,7 +1284,7 @@
event->y - fe->oy, button))
gtk_widget_destroy(fe->window);
- return TRUE;
+ return true;
}
static gint motion_event(GtkWidget *widget, GdkEventMotion *event,
@@ -1294,7 +1294,7 @@
int button;
if (!backing_store_ok(fe))
- return TRUE;
+ return true;
if (event->state & (GDK_BUTTON2_MASK | GDK_SHIFT_MASK))
button = MIDDLE_DRAG;
@@ -1303,7 +1303,7 @@
else if (event->state & GDK_BUTTON3_MASK)
button = RIGHT_DRAG;
else
- return FALSE; /* don't even know what button! */
+ return false; /* don't even know what button! */
if (!midend_process_key(fe->me, event->x - fe->ox,
event->y - fe->oy, button))
@@ -1314,7 +1314,7 @@
gdk_window_get_pointer(gtk_widget_get_window(widget), NULL, NULL, NULL);
#endif
- return TRUE;
+ return true;
}
#if GTK_CHECK_VERSION(3,0,0)
@@ -1329,7 +1329,7 @@
dirtyrect.width, dirtyrect.height);
cairo_fill(cr);
- return TRUE;
+ return true;
}
#else
static gint expose_area(GtkWidget *widget, GdkEventExpose *event,
@@ -1351,7 +1351,7 @@
event->area.width, event->area.height);
#endif
}
- return TRUE;
+ return true;
}
#endif
@@ -1367,7 +1367,7 @@
*/
gtk_widget_queue_draw(fe->window);
- return TRUE;
+ return true;
}
static void resize_puzzle_to_area(frontend *fe, int x, int y)
@@ -1376,7 +1376,7 @@
fe->w = x;
fe->h = y;
- midend_size(fe->me, &x, &y, TRUE);
+ midend_size(fe->me, &x, &y, true);
fe->pw = x;
fe->ph = y;
fe->ox = (fe->w - fe->pw) / 2;
@@ -1398,9 +1398,9 @@
frontend *fe = (frontend *)data;
resize_puzzle_to_area(fe, event->width, event->height);
#if GTK_CHECK_VERSION(3,0,0)
- fe->awaiting_resize_ack = FALSE;
+ fe->awaiting_resize_ack = false;
#endif
- return TRUE;
+ return true;
}
#if GTK_CHECK_VERSION(3,0,0)
@@ -1412,7 +1412,7 @@
GtkAllocation a;
gtk_widget_get_allocation(fe->area, &a);
resize_puzzle_to_area(fe, a.width, a.height);
- fe->awaiting_resize_ack = FALSE;
+ fe->awaiting_resize_ack = false;
}
}
#endif
@@ -1440,7 +1440,7 @@
return; /* can happen due to --generate */
if (fe->timer_active)
g_source_remove(fe->timer_id);
- fe->timer_active = FALSE;
+ fe->timer_active = false;
}
void activate_timer(frontend *fe)
@@ -1451,7 +1451,7 @@
fe->timer_id = g_timeout_add(20, timer_func, fe);
gettimeofday(&fe->last_time, NULL);
}
- fe->timer_active = TRUE;
+ fe->timer_active = true;
}
static void window_destroy(GtkWidget *widget, gpointer data)
@@ -1468,10 +1468,10 @@
*/
if (event->keyval == GDK_KEY_Escape) {
g_signal_emit_by_name(cancelbutton, "clicked");
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
enum { MB_OK, MB_YESNO };
@@ -1509,7 +1509,7 @@
gtk_window_set_title(GTK_WINDOW(window), title);
ret = gtk_dialog_run(GTK_DIALOG(window));
gtk_widget_destroy(window);
- return (type == MB_OK ? TRUE : (ret == GTK_RESPONSE_YES));
+ return (type == MB_OK ? true : (ret == GTK_RESPONSE_YES));
}
#else /* GTK_CHECK_VERSION(3,0,0) */
static void msgbox_button_clicked(GtkButton *button, gpointer data)
@@ -1534,15 +1534,15 @@
window = gtk_dialog_new();
text = gtk_label_new(msg);
align_label(GTK_LABEL(text), 0.0, 0.0);
- hbox = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), text, FALSE, FALSE, 20);
+ hbox = gtk_hbox_new(false, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), text, false, false, 20);
gtk_box_pack_start
(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(window))),
- hbox, FALSE, FALSE, 20);
+ hbox, false, false, 20);
gtk_widget_show(text);
gtk_widget_show(hbox);
gtk_window_set_title(GTK_WINDOW(window), title);
- gtk_label_set_line_wrap(GTK_LABEL(text), TRUE);
+ gtk_label_set_line_wrap(GTK_LABEL(text), true);
if (type == MB_OK) {
titles = LABEL_OK "\0";
@@ -1559,10 +1559,10 @@
button = gtk_button_new_with_our_label(titles);
gtk_box_pack_end
(GTK_BOX(gtk_dialog_get_action_area(GTK_DIALOG(window))),
- button, FALSE, FALSE, 0);
+ button, false, false, 0);
gtk_widget_show(button);
if (i == def) {
- gtk_widget_set_can_default(button, TRUE);
+ gtk_widget_set_can_default(button, true);
gtk_window_set_default(GTK_WINDOW(window), button);
}
if (i == cancel) {
@@ -1579,19 +1579,19 @@
g_object_set_data(G_OBJECT(window), "user-data", &i);
g_signal_connect(G_OBJECT(window), "destroy",
G_CALLBACK(window_destroy), NULL);
- gtk_window_set_modal(GTK_WINDOW(window), TRUE);
+ gtk_window_set_modal(GTK_WINDOW(window), true);
gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(parent));
/* set_transient_window_pos(parent, window); */
gtk_widget_show(window);
i = -1;
gtk_main();
- return (type == MB_YESNO ? i == 1 : TRUE);
+ return (type == MB_YESNO ? i == 1 : true);
}
#endif /* GTK_CHECK_VERSION(3,0,0) */
void error_box(GtkWidget *parent, const char *msg)
{
- message_box(parent, "Error", msg, FALSE, MB_OK);
+ message_box(parent, "Error", msg, false, MB_OK);
}
static void config_ok_button_clicked(GtkButton *button, gpointer data)
@@ -1604,7 +1604,7 @@
if (err)
error_box(fe->cfgbox, err);
else {
- fe->cfgret = TRUE;
+ fe->cfgret = true;
gtk_widget_destroy(fe->cfgbox);
changed_preset(fe);
}
@@ -1636,7 +1636,7 @@
"key_press_event", event, &return_val);
return return_val;
}
- return FALSE;
+ return false;
}
static void editbox_changed(GtkEditable *ed, gpointer data)
@@ -1674,22 +1674,22 @@
fe->cfg = midend_get_config(fe->me, which, &title);
fe->cfg_which = which;
- fe->cfgret = FALSE;
+ fe->cfgret = false;
#if GTK_CHECK_VERSION(3,0,0)
/* GtkDialog isn't quite flexible enough */
fe->cfgbox = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- content_box = GTK_BOX(gtk_vbox_new(FALSE, 8));
+ content_box = GTK_BOX(gtk_vbox_new(false, 8));
g_object_set(G_OBJECT(content_box), "margin", 8, (const char *)NULL);
gtk_widget_show(GTK_WIDGET(content_box));
gtk_container_add(GTK_CONTAINER(fe->cfgbox), GTK_WIDGET(content_box));
- button_box = GTK_BOX(gtk_hbox_new(FALSE, 8));
+ button_box = GTK_BOX(gtk_hbox_new(false, 8));
gtk_widget_show(GTK_WIDGET(button_box));
- gtk_box_pack_end(content_box, GTK_WIDGET(button_box), FALSE, FALSE, 0);
+ gtk_box_pack_end(content_box, GTK_WIDGET(button_box), false, false, 0);
{
GtkWidget *sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
gtk_widget_show(sep);
- gtk_box_pack_end(content_box, sep, FALSE, FALSE, 0);
+ gtk_box_pack_end(content_box, sep, false, false, 0);
}
#else
fe->cfgbox = gtk_dialog_new();
@@ -1700,7 +1700,7 @@
sfree(title);
w = gtk_button_new_with_our_label(LABEL_CANCEL);
- gtk_box_pack_end(button_box, w, FALSE, FALSE, 0);
+ gtk_box_pack_end(button_box, w, false, false, 0);
gtk_widget_show(w);
g_signal_connect(G_OBJECT(w), "clicked",
G_CALLBACK(config_cancel_button_clicked), fe);
@@ -1707,9 +1707,9 @@
cancel = w;
w = gtk_button_new_with_our_label(LABEL_OK);
- gtk_box_pack_end(button_box, w, FALSE, FALSE, 0);
+ gtk_box_pack_end(button_box, w, false, false, 0);
gtk_widget_show(w);
- gtk_widget_set_can_default(w, TRUE);
+ gtk_widget_set_can_default(w, true);
gtk_window_set_default(GTK_WINDOW(fe->cfgbox), w);
g_signal_connect(G_OBJECT(w), "clicked",
G_CALLBACK(config_ok_button_clicked), fe);
@@ -1717,10 +1717,10 @@
#if GTK_CHECK_VERSION(3,0,0)
table = gtk_grid_new();
#else
- table = gtk_table_new(1, 2, FALSE);
+ table = gtk_table_new(1, 2, false);
#endif
y = 0;
- gtk_box_pack_start(content_box, table, FALSE, FALSE, 0);
+ gtk_box_pack_start(content_box, table, false, false, 0);
gtk_widget_show(table);
for (i = fe->cfg; i->type != C_END; i++) {
@@ -1749,7 +1749,7 @@
w = gtk_entry_new();
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), w, 1, y, 1, 1);
- g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL);
+ g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), w, 1, 2, y, y+1,
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
@@ -1774,7 +1774,7 @@
G_CALLBACK(button_toggled), i);
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), w, 0, y, 2, 1);
- g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL);
+ g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), w, 0, 2, y, y+1,
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
@@ -1839,7 +1839,7 @@
i->u.choices.selected);
cr = gtk_cell_renderer_text_new();
- gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(w), cr, TRUE);
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(w), cr, true);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(w), cr,
"text", 0, NULL);
@@ -1849,7 +1849,7 @@
#if GTK_CHECK_VERSION(3,0,0)
gtk_grid_attach(GTK_GRID(table), w, 1, y, 1, 1);
- g_object_set(G_OBJECT(w), "hexpand", TRUE, (const char *)NULL);
+ g_object_set(G_OBJECT(w), "hexpand", true, (const char *)NULL);
#else
gtk_table_attach(GTK_TABLE(table), w, 1, 2, y, y+1,
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
@@ -1867,7 +1867,7 @@
G_CALLBACK(window_destroy), NULL);
g_signal_connect(G_OBJECT(fe->cfgbox), "key_press_event",
G_CALLBACK(win_key_press), cancel);
- gtk_window_set_modal(GTK_WINDOW(fe->cfgbox), TRUE);
+ gtk_window_set_modal(GTK_WINDOW(fe->cfgbox), true);
gtk_window_set_transient_for(GTK_WINDOW(fe->cfgbox),
GTK_WINDOW(fe->window));
/* set_transient_window_pos(fe->window, fe->cfgbox); */
@@ -1906,7 +1906,7 @@
*/
x = INT_MAX;
y = INT_MAX;
- midend_size(fe->me, &x, &y, FALSE);
+ midend_size(fe->me, &x, &y, false);
*px = x;
*py = y;
}
@@ -1924,11 +1924,11 @@
{
int n = midend_which_preset(fe->me);
- fe->preset_threaded = TRUE;
+ fe->preset_threaded = true;
if (n < 0 && fe->preset_custom) {
gtk_check_menu_item_set_active(
GTK_CHECK_MENU_ITEM(fe->preset_custom),
- TRUE);
+ true);
} else {
GSList *gs = fe->preset_radio;
GSList *found = NULL;
@@ -1939,15 +1939,15 @@
G_OBJECT(gs->data), "user-data");
if (!entry || entry->id != n)
gtk_check_menu_item_set_active(
- GTK_CHECK_MENU_ITEM(gs->data), FALSE);
+ GTK_CHECK_MENU_ITEM(gs->data), false);
else
found = gs;
}
if (found)
gtk_check_menu_item_set_active(
- GTK_CHECK_MENU_ITEM(found->data), TRUE);
+ GTK_CHECK_MENU_ITEM(found->data), true);
}
- fe->preset_threaded = FALSE;
+ fe->preset_threaded = false;
/*
* Update the greying on the Copy menu option.
@@ -1969,7 +1969,7 @@
* space it ever will.)
*/
if (!w)
- return FALSE; /* nonexistent widgets aren't a problem */
+ return false; /* nonexistent widgets aren't a problem */
#if GTK_CHECK_VERSION(2,18,0) /* skip if no gtk_widget_get_allocation */
{
@@ -1976,11 +1976,11 @@
GtkAllocation a;
gtk_widget_get_allocation(w, &a);
if (a.height == 0 || a.width == 0)
- return TRUE; /* widget exists but has no size yet */
+ return true; /* widget exists but has no size yet */
}
#endif
- return FALSE;
+ return false;
}
static void try_shrink_drawing_area(frontend *fe)
@@ -2004,7 +2004,7 @@
* shrinking to less than the size we intended.
*/
gtk_drawing_area_size(GTK_DRAWING_AREA(fe->area), 1, 1);
- fe->drawing_area_shrink_pending = FALSE;
+ fe->drawing_area_shrink_pending = false;
}
}
#endif /* !GTK_CHECK_VERSION(3,0,0) */
@@ -2022,7 +2022,7 @@
frontend *fe = (frontend *)data;
try_shrink_drawing_area(fe);
#endif
- return FALSE;
+ return false;
}
#if GTK_CHECK_VERSION(3,0,0)
@@ -2051,9 +2051,9 @@
#if GTK_CHECK_VERSION(3,0,0)
gtk_window_resize(GTK_WINDOW(fe->window), x, y + window_extra_height(fe));
- fe->awaiting_resize_ack = TRUE;
+ fe->awaiting_resize_ack = true;
#else
- fe->drawing_area_shrink_pending = FALSE;
+ fe->drawing_area_shrink_pending = false;
gtk_drawing_area_size(GTK_DRAWING_AREA(fe->area), x, y);
{
GtkRequisition req;
@@ -2060,7 +2060,7 @@
gtk_widget_size_request(GTK_WIDGET(fe->window), &req);
gtk_window_resize(GTK_WINDOW(fe->window), req.width, req.height);
}
- fe->drawing_area_shrink_pending = TRUE;
+ fe->drawing_area_shrink_pending = true;
try_shrink_drawing_area(fe);
#endif
}
@@ -2084,14 +2084,14 @@
}
GdkAtom compound_text_atom, utf8_string_atom;
-int paste_initialised = FALSE;
+int paste_initialised = false;
static void set_selection(frontend *fe, GdkAtom selection)
{
if (!paste_initialised) {
- compound_text_atom = gdk_atom_intern("COMPOUND_TEXT", FALSE);
- utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE);
- paste_initialised = TRUE;
+ compound_text_atom = gdk_atom_intern("COMPOUND_TEXT", false);
+ utf8_string_atom = gdk_atom_intern("UTF8_STRING", false);
+ paste_initialised = true;
}
/*
@@ -2139,7 +2139,7 @@
sfree(fe->paste_data);
fe->paste_data = NULL;
fe->paste_data_len = 0;
- return TRUE;
+ return true;
}
static void menu_copy_event(GtkMenuItem *menuitem, gpointer data)
@@ -2177,7 +2177,7 @@
fe->filesel_name = NULL;
- gtk_window_set_modal(GTK_WINDOW(filesel), TRUE);
+ gtk_window_set_modal(GTK_WINDOW(filesel), true);
g_object_set_data
(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "user-data",
(gpointer)filesel);
@@ -2254,7 +2254,7 @@
frontend *fe = (frontend *)data;
char *name;
- name = file_selector(fe, "Enter name of game file to save", TRUE);
+ name = file_selector(fe, "Enter name of game file to save", true);
if (name) {
FILE *fp;
@@ -2267,7 +2267,7 @@
sprintf(buf, "Are you sure you want to overwrite the"
" file \"%.*s\"?",
FILENAME_MAX, name);
- if (!message_box(fe->window, "Question", buf, TRUE, MB_YESNO))
+ if (!message_box(fe->window, "Question", buf, true, MB_YESNO))
goto free_and_return;
}
@@ -2303,7 +2303,7 @@
char *name;
const char *err;
- name = file_selector(fe, "Enter name of saved game file to load", FALSE);
+ name = file_selector(fe, "Enter name of saved game file to load", false);
if (name) {
FILE *fp = fopen(name, "r");
@@ -2393,7 +2393,7 @@
"from Simon Tatham's Portable Puzzle Collection\n\n"
"%.500s", thegame.name, ver);
- message_box(fe->window, titlebuf, textbuf, TRUE, MB_OK);
+ message_box(fe->window, titlebuf, textbuf, true, MB_OK);
#endif
}
@@ -2485,7 +2485,7 @@
fe->css_provider = NULL;
#endif
- fe->timer_active = FALSE;
+ fe->timer_active = false;
fe->timer_id = -1;
fe->me = midend_new(fe, &thegame, >k_drawing, fe);
@@ -2568,7 +2568,7 @@
GtkSettings *settings = gtk_settings_get_default();
if (!g_object_class_find_property(G_OBJECT_GET_CLASS(settings),
prop)) {
- fe->menubar_is_local = TRUE;
+ fe->menubar_is_local = true;
} else {
int unity_mode;
g_object_get(gtk_settings_get_default(),
@@ -2580,13 +2580,13 @@
#endif
#if GTK_CHECK_VERSION(3,0,0)
- fe->awaiting_resize_ack = FALSE;
+ fe->awaiting_resize_ack = false;
#endif
fe->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(fe->window), thegame.name);
- vbox = GTK_BOX(gtk_vbox_new(FALSE, 0));
+ vbox = GTK_BOX(gtk_vbox_new(false, 0));
gtk_container_add(GTK_CONTAINER(fe->window), GTK_WIDGET(vbox));
gtk_widget_show(GTK_WIDGET(vbox));
@@ -2596,12 +2596,12 @@
* gtk_window_add_accel_group; see menu_key_event
*/
- hbox = GTK_BOX(gtk_hbox_new(FALSE, 0));
- gtk_box_pack_start(vbox, GTK_WIDGET(hbox), FALSE, FALSE, 0);
+ hbox = GTK_BOX(gtk_hbox_new(false, 0));
+ gtk_box_pack_start(vbox, GTK_WIDGET(hbox), false, false, 0);
gtk_widget_show(GTK_WIDGET(hbox));
fe->menubar = gtk_menu_bar_new();
- gtk_box_pack_start(hbox, fe->menubar, TRUE, TRUE, 0);
+ gtk_box_pack_start(hbox, fe->menubar, true, true, 0);
gtk_widget_show(fe->menubar);
menuitem = gtk_menu_item_new_with_mnemonic("_Game");
@@ -2637,7 +2637,7 @@
fe->preset_radio = NULL;
fe->preset_custom = NULL;
- fe->preset_threaded = FALSE;
+ fe->preset_threaded = false;
preset_menu = midend_get_presets(fe->me, NULL);
if (preset_menu->n_entries > 0 || thegame.can_configure) {
@@ -2725,7 +2725,7 @@
GINT_TO_POINTER(UI_REDO));
g_signal_connect(G_OBJECT(menuitem), "clicked",
G_CALLBACK(menu_key_event), fe);
- gtk_box_pack_end(hbox, menuitem, FALSE, FALSE, 0);
+ gtk_box_pack_end(hbox, menuitem, false, false, 0);
gtk_widget_show(menuitem);
menuitem=gtk_button_new_with_mnemonic("_Undo");
@@ -2733,12 +2733,12 @@
GINT_TO_POINTER(UI_UNDO));
g_signal_connect(G_OBJECT(menuitem), "clicked",
G_CALLBACK(menu_key_event), fe);
- gtk_box_pack_end(hbox, menuitem, FALSE, FALSE, 0);
+ gtk_box_pack_end(hbox, menuitem, false, false, 0);
gtk_widget_show(menuitem);
if (thegame.flags & REQUIRE_NUMPAD) {
- hbox = GTK_BOX(gtk_hbox_new(FALSE, 0));
- gtk_box_pack_start(vbox, GTK_WIDGET(hbox), FALSE, FALSE, 0);
+ hbox = GTK_BOX(gtk_hbox_new(false, 0));
+ gtk_box_pack_start(vbox, GTK_WIDGET(hbox), false, false, 0);
gtk_widget_show(GTK_WIDGET(hbox));
*((int*)errbuf)=0;
@@ -2749,7 +2749,7 @@
GINT_TO_POINTER((int)(errbuf[0])));
g_signal_connect(G_OBJECT(menuitem), "clicked",
G_CALLBACK(menu_key_event), fe);
- gtk_box_pack_start(hbox, menuitem, TRUE, TRUE, 0);
+ gtk_box_pack_start(hbox, menuitem, true, true, 0);
gtk_widget_show(menuitem);
}
}
@@ -2768,7 +2768,7 @@
fe->statusbar = gtk_statusbar_new();
gtk_container_add(GTK_CONTAINER(viewport), fe->statusbar);
gtk_widget_show(viewport);
- gtk_box_pack_end(vbox, viewport, FALSE, FALSE, 0);
+ gtk_box_pack_end(vbox, viewport, false, false, 0);
gtk_widget_show(fe->statusbar);
fe->statusctx = gtk_statusbar_get_context_id
(GTK_STATUSBAR(fe->statusbar), "game");
@@ -2785,7 +2785,7 @@
fe->area = gtk_drawing_area_new();
#if GTK_CHECK_VERSION(2,0,0) && !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_set_double_buffered(fe->area, FALSE);
+ gtk_widget_set_double_buffered(fe->area, false);
#endif
{
GdkGeometry geom;
@@ -2807,11 +2807,11 @@
gtk_window_set_default_size(GTK_WINDOW(fe->window),
x, y + window_extra_height(fe));
#else
- fe->drawing_area_shrink_pending = FALSE;
+ fe->drawing_area_shrink_pending = false;
gtk_drawing_area_size(GTK_DRAWING_AREA(fe->area), x, y);
#endif
- gtk_box_pack_end(vbox, fe->area, TRUE, TRUE, 0);
+ gtk_box_pack_end(vbox, fe->area, true, true, 0);
clear_backing_store(fe);
fe->fonts = NULL;
@@ -2877,7 +2877,7 @@
gtk_widget_show(fe->window);
#if !GTK_CHECK_VERSION(3,0,0)
- fe->drawing_area_shrink_pending = TRUE;
+ fe->drawing_area_shrink_pending = true;
try_shrink_drawing_area(fe);
#endif
@@ -2893,7 +2893,7 @@
for (i = 0; i < menu->n_entries; i++) {
if (menu->entries[i].params) {
char *paramstr = thegame.encode_params(
- menu->entries[i].params, TRUE);
+ menu->entries[i].params, true);
printf("%s %s\n", paramstr, menu->entries[i].title);
sfree(paramstr);
} else {
@@ -2906,9 +2906,9 @@
{
char *pname = argv[0];
char *error;
- int ngenerate = 0, print = FALSE, px = 1, py = 1;
- int time_generation = FALSE, test_solve = FALSE, list_presets = FALSE;
- int soln = FALSE, colour = FALSE;
+ int ngenerate = 0, print = false, px = 1, py = 1;
+ int time_generation = false, test_solve = false, list_presets = false;
+ int soln = false, colour = false;
float scale = 1.0F;
float redo_proportion = 0.0F;
const char *savefile = NULL, *savesuffix = NULL;
@@ -2915,7 +2915,7 @@
char *arg = NULL;
int argtype = ARG_EITHER;
char *screenshot_file = NULL;
- int doing_opts = TRUE;
+ int doing_opts = true;
int ac = argc;
char **av = argv;
char errbuf[500];
@@ -2961,11 +2961,11 @@
} else
ngenerate = 1;
} else if (doing_opts && !strcmp(p, "--time-generation")) {
- time_generation = TRUE;
+ time_generation = true;
} else if (doing_opts && !strcmp(p, "--test-solve")) {
- test_solve = TRUE;
+ test_solve = true;
} else if (doing_opts && !strcmp(p, "--list-presets")) {
- list_presets = TRUE;
+ list_presets = true;
} else if (doing_opts && !strcmp(p, "--save")) {
if (--ac > 0) {
savefile = *++av;
@@ -2989,7 +2989,7 @@
pname);
return 1;
}
- print = TRUE;
+ print = true;
if (--ac > 0) {
char *dim = *++av;
if (sscanf(dim, "%dx%d", &px, &py) != 2) {
@@ -3059,7 +3059,7 @@
!strcmp(p, "--solution") ||
!strcmp(p, "--solns") ||
!strcmp(p, "--soln"))) {
- soln = TRUE;
+ soln = true;
} else if (doing_opts && !strcmp(p, "--colour")) {
if (!thegame.can_print_in_colour) {
fprintf(stderr, "%s: this game does not support colour"
@@ -3066,13 +3066,13 @@
" printing\n", pname);
return 1;
}
- colour = TRUE;
+ colour = true;
} else if (doing_opts && !strcmp(p, "--load")) {
argtype = ARG_SAVE;
} else if (doing_opts && !strcmp(p, "--game")) {
argtype = ARG_ID;
} else if (doing_opts && !strcmp(p, "--")) {
- doing_opts = FALSE;
+ doing_opts = false;
} else if (!doing_opts || p[0] != '-') {
if (arg) {
fprintf(stderr, "%s: more than one argument supplied\n",
--- a/guess.c
+++ b/guess.c
@@ -77,8 +77,8 @@
const char *name;
game_params params;
} guess_presets[] = {
- {"Standard", {6, 4, 10, FALSE, TRUE}},
- {"Super", {8, 5, 12, FALSE, TRUE}},
+ {"Standard", {6, 4, 10, false, true}},
+ {"Super", {8, 5, 12, false, true}},
};
@@ -85,7 +85,7 @@
static bool game_fetch_preset(int i, char **name, game_params **params)
{
if (i < 0 || i >= lenof(guess_presets))
- return FALSE;
+ return false;
*name = dupstr(guess_presets[i].name);
/*
@@ -96,7 +96,7 @@
*params = dup_params(&tmp);
}
- return TRUE;
+ return true;
}
static void decode_params(game_params *params, char const *string)
@@ -272,7 +272,7 @@
colcount->pegs[c]++;
bmp[i] = (unsigned char)(c+1);
}
- obfuscate_bitmap(bmp, params->npegs*8, FALSE);
+ obfuscate_bitmap(bmp, params->npegs*8, false);
ret = bin2hex(bmp, params->npegs);
sfree(bmp);
@@ -291,7 +291,7 @@
if (strlen(desc) != params->npegs * 2)
return "Game description is wrong length";
bmp = hex2bin(desc, params->npegs);
- obfuscate_bitmap(bmp, params->npegs*8, TRUE);
+ obfuscate_bitmap(bmp, params->npegs*8, true);
for (i = 0; i < params->npegs; i++) {
if (bmp[i] < 1 || bmp[i] > params->ncolours) {
sfree(bmp);
@@ -318,7 +318,7 @@
state->solution = new_pegrow(params->npegs);
bmp = hex2bin(desc, params->npegs);
- obfuscate_bitmap(bmp, params->npegs*8, TRUE);
+ obfuscate_bitmap(bmp, params->npegs*8, true);
for (i = 0; i < params->npegs; i++)
state->solution->pegs[i] = (int)bmp[i];
sfree(bmp);
@@ -367,7 +367,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -729,7 +729,7 @@
for (i = 0; i < state->params.npegs; ++i)
ui->curr_pegs->pegs[i] = ui->hint->pegs[i];
- ui->markable = TRUE;
+ ui->markable = true;
ui->peg_cur = state->params.npegs;
ui->display_cur = 1;
return;
@@ -1236,7 +1236,7 @@
if (labelled)
scol |= 0x4000;
if ((dest->pegs[i] != scol) || force) {
- draw_peg(dr, ds, rowx + PEGOFF * i, rowy, FALSE, labelled,
+ draw_peg(dr, ds, rowx + PEGOFF * i, rowy, false, labelled,
scol &~ 0x7000);
/*
* Hold marker.
@@ -1268,7 +1268,7 @@
* Because of the possible presence of the cursor around this
* entire section, we redraw all or none of it but never part.
*/
- need_redraw = FALSE;
+ need_redraw = false;
for (i = 0; i < dest->npegs; i++) {
scol = src ? src->feedback[i] : 0;
@@ -1277,7 +1277,7 @@
if (i == 0 && markable)
scol |= 0x2000;
if ((scol != dest->feedback[i]) || force) {
- need_redraw = TRUE;
+ need_redraw = true;
}
dest->feedback[i] = scol;
}
@@ -1364,7 +1364,7 @@
if (ui->show_labels)
val |= 0x2000;
if (ds->colours->pegs[i] != val) {
- draw_peg(dr, ds, COL_X(i), COL_Y(i), FALSE, ui->show_labels, i+1);
+ draw_peg(dr, ds, COL_X(i), COL_Y(i), false, ui->show_labels, i+1);
if (val & 0x1000)
draw_cursor(dr, ds, COL_X(i), COL_Y(i));
ds->colours->pegs[i] = val;
@@ -1380,11 +1380,11 @@
guess_redraw(dr, ds, i, state->guesses[i], NULL, -1, 0,
ui->show_labels);
hint_redraw(dr, ds, i, state->guesses[i],
- i == (state->next_go-1) ? 1 : 0, FALSE, FALSE);
+ i == (state->next_go-1) ? 1 : 0, false, false);
} else if (i > state->next_go) {
/* we've not got here yet; it's blank. */
guess_redraw(dr, ds, i, NULL, NULL, -1, 0, ui->show_labels);
- hint_redraw(dr, ds, i, NULL, 0, FALSE, FALSE);
+ hint_redraw(dr, ds, i, NULL, 0, false, false);
}
}
if (!state->solved) {
@@ -1425,7 +1425,7 @@
ds->blit_ox = ox - 1; ds->blit_oy = oy - 1;
debug(("Saving to blitter at (%d,%d)", ds->blit_ox, ds->blit_oy));
blitter_save(dr, ds->blit_peg, ds->blit_ox, ds->blit_oy);
- draw_peg(dr, ds, ox, oy, TRUE, ui->show_labels, ui->drag_col);
+ draw_peg(dr, ds, ox, oy, true, ui->show_labels, ui->drag_col);
}
ds->drag_col = ui->drag_col;
@@ -1457,7 +1457,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1480,7 +1480,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1487,8 +1487,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1505,9 +1505,9 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/inertia.c
+++ b/inertia.c
@@ -127,7 +127,7 @@
char namebuf[80];
if (i < 0 || i >= lenof(inertia_presets))
- return FALSE;
+ return false;
p = inertia_presets[i];
ret = dup_params(&p);
@@ -136,7 +136,7 @@
*params = ret;
*name = retname;
- return TRUE;
+ return true;
}
static void decode_params(game_params *params, char const *string)
@@ -247,7 +247,7 @@
int x1, int y1, int dir1, int x2, int y2, int dir2)
{
/*
- * Returns TRUE if we can transition directly from (x1,y1)
+ * Returns true if we can transition directly from (x1,y1)
* going in direction dir1, to (x2,y2) going in direction dir2.
*/
@@ -257,7 +257,7 @@
*/
if (AT(w, h, grid, x1, y1) == WALL ||
AT(w, h, grid, x1, y1) == MINE)
- return FALSE;
+ return false;
/*
* If a move is capable of stopping at x1,y1,dir1, and x2,y2 is
@@ -271,7 +271,7 @@
(AT(w, h, grid, x1, y1) == STOP ||
AT(w, h, grid, x1, y1) == START ||
AT(w, h, grid, x1+DX(dir1), y1+DY(dir1)) == WALL))
- return TRUE;
+ return true;
/*
* If a move is capable of continuing here, then x1,y1,dir1 can
@@ -282,12 +282,12 @@
AT(w, h, grid, x2, y2) == GEM ||
AT(w, h, grid, x2, y2) == STOP ||
AT(w, h, grid, x2, y2) == START))
- return TRUE;
+ return true;
/*
* That's it.
*/
- return FALSE;
+ return false;
}
static int find_gem_candidates(int w, int h, char *grid,
@@ -351,7 +351,7 @@
for (dir = 0; dir < DIRECTIONS; dir++) {
int index = (sy*w+sx)*DIRECTIONS+dir;
sc->positions[tail++] = index;
- reachable[index] = TRUE;
+ reachable[index] = true;
#ifdef SOLVER_DIAGNOSTICS
printf("starting point %d,%d,%d\n", sx, sy, dir);
#endif
@@ -405,7 +405,7 @@
#endif
if (ok) {
sc->positions[tail++] = i2;
- reachable[i2] = TRUE;
+ reachable[i2] = true;
}
}
}
@@ -642,9 +642,9 @@
assert(state->px >= 0 && state->py >= 0);
state->distance_moved = 0;
- state->dead = FALSE;
+ state->dead = false;
- state->cheated = FALSE;
+ state->cheated = false;
state->solnpos = 0;
state->soln = NULL;
@@ -662,7 +662,7 @@
ret->gems = state->gems;
ret->grid = snewn(wh, char);
ret->distance_moved = state->distance_moved;
- ret->dead = FALSE;
+ ret->dead = false;
memcpy(ret->grid, state->grid, wh);
ret->cheated = state->cheated;
ret->soln = state->soln;
@@ -892,10 +892,10 @@
*/
unvisited = snewn(wh, int);
for (i = 0; i < wh; i++)
- unvisited[i] = FALSE;
+ unvisited[i] = false;
for (i = 0; i < wh; i++)
if (currstate->grid[i] == GEM)
- unvisited[i] = TRUE;
+ unvisited[i] = true;
/*
* Allocate space for doing bfses inside the main loop.
@@ -1175,7 +1175,7 @@
for (i = n1; i <= n2; i++) {
int pos = nodes[circuit[i]] / DP1;
assert(pos >= 0 && pos < wh);
- unvisited[pos] = FALSE;
+ unvisited[pos] = false;
}
}
@@ -1445,7 +1445,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1501,8 +1501,8 @@
ui->anim_length = 0.0F;
ui->flashtype = 0;
ui->deaths = 0;
- ui->just_made_move = FALSE;
- ui->just_died = FALSE;
+ ui->just_made_move = false;
+ ui->just_died = false;
return ui;
}
@@ -1539,11 +1539,11 @@
if (!oldstate->dead && newstate->dead && ui->just_made_move &&
oldstate->gems) {
ui->deaths++;
- ui->just_died = TRUE;
+ ui->just_died = true;
} else {
- ui->just_died = FALSE;
+ ui->just_died = false;
}
- ui->just_made_move = FALSE;
+ ui->just_made_move = false;
}
struct game_drawstate {
@@ -1637,7 +1637,7 @@
* Otherwise, we can make the move. All we need to specify is
* the direction.
*/
- ui->just_made_move = TRUE;
+ ui->just_made_move = true;
sprintf(buf, "%d", dir);
return dupstr(buf);
}
@@ -1662,7 +1662,7 @@
ret->soln = sol;
sol->refcount = 1;
- ret->cheated = TRUE;
+ ret->cheated = true;
ret->solnpos = 0;
}
@@ -1716,7 +1716,7 @@
}
if (AT(w, h, ret->grid, ret->px, ret->py) == MINE) {
- ret->dead = TRUE;
+ ret->dead = true;
break;
}
@@ -1823,11 +1823,11 @@
/* We can't allocate the blitter rectangle for the player background
* until we know what size to make it. */
ds->player_background = NULL;
- ds->player_bg_saved = FALSE;
+ ds->player_bg_saved = false;
ds->pbgx = ds->pbgy = -1;
ds->p = state->p; /* structure copy */
- ds->started = FALSE;
+ ds->started = false;
ds->grid = snewn(wh, unsigned short);
for (i = 0; i < wh; i++)
ds->grid[i] = UNDRAWN;
@@ -2001,7 +2001,7 @@
assert(ds->player_background);
blitter_load(dr, ds->player_background, ds->pbgx, ds->pbgy);
draw_update(dr, ds->pbgx, ds->pbgy, TILESIZE, TILESIZE);
- ds->player_bg_saved = FALSE;
+ ds->player_bg_saved = false;
}
/*
@@ -2027,7 +2027,7 @@
draw_line(dr, COORD(x), COORD(0), COORD(x), COORD(h),
COL_LOWLIGHT);
- ds->started = TRUE;
+ ds->started = true;
}
/*
@@ -2153,7 +2153,7 @@
(state->dead && !oldstate),
(!oldstate && state->soln ?
state->soln->list[state->solnpos] : -1));
- ds->player_bg_saved = TRUE;
+ ds->player_bg_saved = true;
}
static float game_anim_length(const game_state *oldstate,
@@ -2193,7 +2193,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2216,7 +2216,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2223,8 +2223,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2241,8 +2241,8 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/keen.c
+++ b/keen.c
@@ -86,22 +86,22 @@
ret->w = 6;
ret->diff = DIFF_NORMAL;
- ret->multiplication_only = FALSE;
+ ret->multiplication_only = false;
return ret;
}
static const struct game_params keen_presets[] = {
- { 4, DIFF_EASY, FALSE },
- { 5, DIFF_EASY, FALSE },
- { 5, DIFF_EASY, TRUE },
- { 6, DIFF_EASY, FALSE },
- { 6, DIFF_NORMAL, FALSE },
- { 6, DIFF_NORMAL, TRUE },
- { 6, DIFF_HARD, FALSE },
- { 6, DIFF_EXTREME, FALSE },
- { 6, DIFF_UNREASONABLE, FALSE },
- { 9, DIFF_NORMAL, FALSE },
+ { 4, DIFF_EASY, false },
+ { 5, DIFF_EASY, false },
+ { 5, DIFF_EASY, true },
+ { 6, DIFF_EASY, false },
+ { 6, DIFF_NORMAL, false },
+ { 6, DIFF_NORMAL, true },
+ { 6, DIFF_HARD, false },
+ { 6, DIFF_EXTREME, false },
+ { 6, DIFF_UNREASONABLE, false },
+ { 9, DIFF_NORMAL, false },
};
static bool game_fetch_preset(int i, char **name, game_params **params)
@@ -110,7 +110,7 @@
char buf[80];
if (i < 0 || i >= lenof(keen_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = keen_presets[i]; /* structure copy */
@@ -120,7 +120,7 @@
*name = dupstr(buf);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -157,7 +157,7 @@
if (*p == 'm') {
p++;
- params->multiplication_only = TRUE;
+ params->multiplication_only = true;
}
}
@@ -676,7 +676,7 @@
int x, y, p0, p1, edge;
if (i == 2*w*(w-1)) {
- edge = TRUE; /* terminating virtual edge */
+ edge = true; /* terminating virtual edge */
} else {
if (i < w*(w-1)) {
y = i/(w-1);
@@ -864,7 +864,7 @@
revorder[order[i]] = i;
for (i = 0; i < a; i++)
- singletons[i] = TRUE;
+ singletons[i] = true;
dsf_init(dsf, a);
@@ -897,7 +897,7 @@
* shapes.
*/
if (best >= 0 && random_upto(rs, 4)) {
- singletons[i] = singletons[best] = FALSE;
+ singletons[i] = singletons[best] = false;
dsf_merge(dsf, i, best);
}
}
@@ -925,7 +925,7 @@
best = i+w;
if (best >= 0) {
- singletons[i] = singletons[best] = FALSE;
+ singletons[i] = singletons[best] = false;
dsf_merge(dsf, i, best);
}
}
@@ -1040,7 +1040,7 @@
for (i = 0; i < a; i++)
clues[i] = 0;
while (1) {
- int done_something = FALSE;
+ int done_something = false;
for (k = 0; k < 4; k++) {
long clue;
@@ -1073,7 +1073,7 @@
}
}
if (i < a)
- done_something = TRUE;
+ done_something = true;
}
if (!done_something)
@@ -1327,7 +1327,7 @@
state->pencil[i] = 0;
}
- state->completed = state->cheated = FALSE;
+ state->completed = state->cheated = false;
return state;
}
@@ -1402,7 +1402,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1504,7 +1504,7 @@
static int check_errors(const game_state *state, long *errors)
{
int w = state->par.w, a = w*w;
- int i, j, x, y, errs = FALSE;
+ int i, j, x, y, errs = false;
long *cluevals;
int *full;
@@ -1514,7 +1514,7 @@
if (errors)
for (i = 0; i < a; i++) {
errors[i] = 0;
- full[i] = TRUE;
+ full[i] = true;
}
for (i = 0; i < a; i++) {
@@ -1550,7 +1550,7 @@
}
if (!state->grid[i])
- full[j] = FALSE;
+ full[j] = false;
}
for (i = 0; i < a; i++) {
@@ -1557,7 +1557,7 @@
j = dsf_canonify(state->clues->dsf, i);
if (j == i) {
if ((state->clues->clues[j] & ~CMASK) != cluevals[i]) {
- errs = TRUE;
+ errs = true;
if (errors && full[j])
errors[j] |= DF_ERR_CLUE;
}
@@ -1576,7 +1576,7 @@
}
if (mask != (1 << (w+1)) - (1 << 1)) {
- errs = TRUE;
+ errs = true;
errmask &= ~1;
if (errors) {
for (x = 0; x < w; x++)
@@ -1595,7 +1595,7 @@
}
if (mask != (1 << (w+1)) - (1 << 1)) {
- errs = TRUE;
+ errs = true;
errmask &= ~1;
if (errors) {
for (y = 0; y < w; y++)
@@ -1704,7 +1704,7 @@
if (move[0] == 'S') {
ret = dup_game(from);
- ret->completed = ret->cheated = TRUE;
+ ret->completed = ret->cheated = true;
for (i = 0; i < a; i++) {
if (move[i+1] < '1' || move[i+1] > '0'+w) {
@@ -1733,7 +1733,7 @@
ret->pencil[y*w+x] = 0;
if (!ret->completed && !check_errors(ret, NULL))
- ret->completed = TRUE;
+ ret->completed = true;
}
return ret;
} else if (move[0] == 'M') {
@@ -1816,7 +1816,7 @@
int i;
ds->tilesize = 0;
- ds->started = FALSE;
+ ds->started = false;
ds->tiles = snewn(a, long);
for (i = 0; i < a; i++)
ds->tiles[i] = -1;
@@ -2056,7 +2056,7 @@
draw_update(dr, 0, 0, SIZE(w), SIZE(w));
- ds->started = TRUE;
+ ds->started = true;
}
check_errors(state, ds->errors);
@@ -2112,8 +2112,8 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
if (state->completed)
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2362,7 +2362,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2369,8 +2369,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2387,9 +2387,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON | REQUIRE_NUMPAD, /* flags */
};
@@ -2403,15 +2403,15 @@
game_state *s;
char *id = NULL, *desc;
const char *err;
- int grade = FALSE;
- int ret, diff, really_show_working = FALSE;
+ int grade = false;
+ int ret, diff, really_show_working = false;
while (--argc > 0) {
char *p = *++argv;
if (!strcmp(p, "-v")) {
- really_show_working = TRUE;
+ really_show_working = true;
} else if (!strcmp(p, "-g")) {
- grade = TRUE;
+ grade = true;
} else if (*p == '-') {
fprintf(stderr, "%s: unrecognised option `%s'\n", argv[0], p);
return 1;
@@ -2447,7 +2447,7 @@
* the puzzle internally before doing anything else.
*/
ret = -1; /* placate optimiser */
- solver_show_working = FALSE;
+ solver_show_working = false;
for (diff = 0; diff < DIFFCOUNT; diff++) {
memset(s->grid, 0, p->w * p->w);
ret = solver(p->w, s->clues->dsf, s->clues->clues,
--- a/latin.c
+++ b/latin.c
@@ -43,7 +43,7 @@
*/
for (i = 1; i <= o; i++)
if (i != n)
- cube(x,y,i) = FALSE;
+ cube(x,y,i) = false;
/*
* Rule out this number in all other positions in the row.
@@ -50,7 +50,7 @@
*/
for (i = 0; i < o; i++)
if (i != y)
- cube(x,i,n) = FALSE;
+ cube(x,i,n) = false;
/*
* Rule out this number in all other positions in the column.
@@ -57,7 +57,7 @@
*/
for (i = 0; i < o; i++)
if (i != x)
- cube(i,y,n) = FALSE;
+ cube(i,y,n) = false;
/*
* Enter the number in the result grid.
@@ -68,7 +68,7 @@
* Cross out this number from the list of numbers left to place
* in its row, its column and its block.
*/
- solver->row[y*o+n-1] = solver->col[x*o+n-1] = TRUE;
+ solver->row[y*o+n-1] = solver->col[x*o+n-1] = true;
}
int latin_solver_elim(struct latin_solver *solver, int start, int step
@@ -170,8 +170,8 @@
* any row with a solitary 1 - and discarding that row and the
* column containing the 1.
*/
- memset(rowidx, TRUE, o);
- memset(colidx, TRUE, o);
+ memset(rowidx, true, o);
+ memset(colidx, true, o);
for (i = 0; i < o; i++) {
int count = 0, first = -1;
for (j = 0; j < o; j++)
@@ -180,7 +180,7 @@
if (count == 0) return -1;
if (count == 1)
- rowidx[i] = colidx[first] = FALSE;
+ rowidx[i] = colidx[first] = false;
}
/*
@@ -226,10 +226,10 @@
*/
int rows = 0;
for (i = 0; i < n; i++) {
- int ok = TRUE;
+ int ok = true;
for (j = 0; j < n; j++)
if (set[j] && grid[i*o+j]) {
- ok = FALSE;
+ ok = false;
break;
}
if (ok)
@@ -261,7 +261,7 @@
}
if (rows >= n - count) {
- int progress = FALSE;
+ int progress = false;
/*
* We've got one! Now, for each row which _doesn't_
@@ -275,10 +275,10 @@
* positions in the cube to meddle with.
*/
for (i = 0; i < n; i++) {
- int ok = TRUE;
+ int ok = true;
for (j = 0; j < n; j++)
if (set[j] && grid[i*o+j]) {
- ok = FALSE;
+ ok = false;
break;
}
if (!ok) {
@@ -310,8 +310,8 @@
names[pn-1], px+1, py+1);
}
#endif
- progress = TRUE;
- solver->cube[fpos] = FALSE;
+ progress = true;
+ solver->cube[fpos] = false;
}
}
}
@@ -522,7 +522,7 @@
xt+1, yt+1);
}
#endif
- cube(xt, yt, orign) = FALSE;
+ cube(xt, yt, orign) = false;
return 1;
}
}
@@ -570,12 +570,12 @@
solver->o = o;
solver->cube = snewn(o*o*o, unsigned char);
solver->grid = grid; /* write straight back to the input */
- memset(solver->cube, TRUE, o*o*o);
+ memset(solver->cube, true, o*o*o);
solver->row = snewn(o*o, unsigned char);
solver->col = snewn(o*o, unsigned char);
- memset(solver->row, FALSE, o*o);
- memset(solver->col, FALSE, o*o);
+ memset(solver->row, false, o*o);
+ memset(solver->col, false, o*o);
for (x = 0; x < o; x++)
for (y = 0; y < o; y++)
--- a/latin.h
+++ b/latin.h
@@ -14,11 +14,11 @@
struct latin_solver {
int o; /* order of latin square */
unsigned char *cube; /* o^3, indexed by x, y, and digit:
- TRUE in that position indicates a possibility */
+ true in that position indicates a possibility */
digit *grid; /* o^2, indexed by x and y: for final deductions */
- unsigned char *row; /* o^2: row[y*cr+n-1] TRUE if n is in row y */
- unsigned char *col; /* o^2: col[x*cr+n-1] TRUE if n is in col x */
+ unsigned char *row; /* o^2: row[y*cr+n-1] true if n is in row y */
+ unsigned char *col; /* o^2: col[x*cr+n-1] true if n is in col x */
#ifdef STANDALONE_SOLVER
char **names; /* o: names[n-1] gives name of 'digit' n */
--- a/lightup.c
+++ b/lightup.c
@@ -210,7 +210,7 @@
char buf[80];
if (i < 0 || i >= lenof(lightup_presets))
- return FALSE;
+ return false;
ret = default_params();
*ret = lightup_presets[i];
@@ -222,7 +222,7 @@
ret->difficulty == 1 ? "tricky" : "easy");
*name = dupstr(buf);
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -1752,7 +1752,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
/* 'borrowed' from slant.c, mainly. I could have printed it one
@@ -1951,7 +1951,7 @@
while (*move) {
c = *move;
if (c == 'S') {
- ret->used_solve = TRUE;
+ ret->used_solve = true;
move++;
} else if (c == 'L' || c == 'I') {
move++;
@@ -2159,7 +2159,7 @@
int dir, const game_ui *ui,
float animtime, float flashtime)
{
- int flashing = FALSE;
+ int flashing = false;
int x,y;
if (flashtime) flashing = (int)(flashtime * 3 / FLASH_TIME) != 1;
@@ -2213,7 +2213,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2260,7 +2260,7 @@
*/
for (y = 0; y < h; y++)
for (x = 0; x < w; x++) {
- unsigned int ds_flags = tile_flags(ds, state, NULL, x, y, FALSE);
+ unsigned int ds_flags = tile_flags(ds, state, NULL, x, y, false);
int dx = COORD(x), dy = COORD(y);
if (ds_flags & DF_BLACK) {
draw_rect(dr, dx, dy, TILE_SIZE, TILE_SIZE, ink);
@@ -2290,7 +2290,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2297,8 +2297,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2315,9 +2315,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/loopgen.c
+++ b/loopgen.c
@@ -84,7 +84,7 @@
grid_dot *starting_dot;
int transitions;
int current_state, s; /* booleans: equal or not-equal to 'colour' */
- int found_same_coloured_neighbour = FALSE;
+ int found_same_coloured_neighbour = false;
assert(board[face_index] != colour);
/* Can only consider a face for colouring if it's adjacent to a face
@@ -93,12 +93,12 @@
grid_edge *e = test_face->edges[i];
grid_face *f = (e->face1 == test_face) ? e->face2 : e->face1;
if (FACE_COLOUR(f) == colour) {
- found_same_coloured_neighbour = TRUE;
+ found_same_coloured_neighbour = true;
break;
}
}
if (!found_same_coloured_neighbour)
- return FALSE;
+ return false;
/* Need to avoid creating a loop of faces of this colour around some
* differently-coloured faces.
@@ -158,11 +158,11 @@
current_state = (FACE_COLOUR(current_face) == colour);
starting_dot = NULL;
starting_face = NULL;
- while (TRUE) {
+ while (true) {
/* Advance to next face.
* Need to loop here because it might take several goes to
* find it. */
- while (TRUE) {
+ while (true) {
j++;
if (j == test_face->dots[i]->order)
j = 0;
@@ -206,7 +206,7 @@
}
}
- return (transitions == 2) ? TRUE : FALSE;
+ return (transitions == 2) ? true : false;
}
/* Count the number of neighbours of 'face', having colour 'colour' */
@@ -361,7 +361,7 @@
}
/* Colour faces one at a time until no more faces are colourable. */
- while (TRUE)
+ while (true)
{
enum face_colour colour;
tree234 *faces_to_pick;
@@ -501,12 +501,12 @@
* make some illicit deductions. To combat this (and make the path more
* interesting), we do one final pass making random flips. */
- /* Set to TRUE for final pass */
- do_random_pass = FALSE;
+ /* Set to true for final pass */
+ do_random_pass = false;
- while (TRUE) {
+ while (true) {
/* Remember whether a flip occurred during this pass */
- int flipped = FALSE;
+ int flipped = false;
for (i = 0; i < num_faces; ++i) {
int j = face_list[i];
@@ -522,7 +522,7 @@
/* normal pass - flip when neighbour count is 1 */
if (face_num_neighbours(g, board, face, opp) == 1) {
board[j] = opp;
- flipped = TRUE;
+ flipped = true;
}
}
}
@@ -529,7 +529,7 @@
}
if (do_random_pass) break;
- if (!flipped) do_random_pass = TRUE;
+ if (!flipped) do_random_pass = true;
}
sfree(face_list);
--- a/loopy.c
+++ b/loopy.c
@@ -319,11 +319,11 @@
#define BIT_SET(field, bit) ((field) & (1<<(bit)))
-#define SET_BIT(field, bit) (BIT_SET(field, bit) ? FALSE : \
- ((field) |= (1<<(bit)), TRUE))
+#define SET_BIT(field, bit) (BIT_SET(field, bit) ? false : \
+ ((field) |= (1<<(bit)), true))
#define CLEAR_BIT(field, bit) (BIT_SET(field, bit) ? \
- ((field) &= ~(1<<(bit)), TRUE) : FALSE)
+ ((field) &= ~(1<<(bit)), true) : false)
#define CLUE2CHAR(c) \
((c < 0) ? ' ' : c < 10 ? c + '0' : c - 10 + 'A')
@@ -388,8 +388,8 @@
ret->dot_solved = snewn(num_dots, char);
ret->face_solved = snewn(num_faces, char);
- memset(ret->dot_solved, FALSE, num_dots);
- memset(ret->face_solved, FALSE, num_faces);
+ memset(ret->dot_solved, false, num_dots);
+ memset(ret->face_solved, false, num_faces);
ret->dot_yes_count = snewn(num_dots, char);
memset(ret->dot_yes_count, 0, num_dots);
@@ -975,7 +975,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static float game_anim_length(const game_state *oldstate,
@@ -987,8 +987,8 @@
static bool game_can_format_as_text_now(const game_params *params)
{
if (params->type != 0)
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1106,7 +1106,7 @@
/* Sets the line (with index i) to the new state 'line_new', and updates
* the cached counts of any affected faces and dots.
- * Returns TRUE if this actually changed the line's state. */
+ * Returns true if this actually changed the line's state. */
static int solver_set_line(solver_state *sstate, int i,
enum line_state line_new
#ifdef SHOW_WORKING
@@ -1123,7 +1123,7 @@
check_caches(sstate);
if (state->lines[i] == line_new) {
- return FALSE; /* nothing changed */
+ return false; /* nothing changed */
}
state->lines[i] = line_new;
@@ -1158,7 +1158,7 @@
}
check_caches(sstate);
- return TRUE;
+ return true;
}
#ifdef SHOW_WORKING
@@ -1170,7 +1170,7 @@
* Merge two dots due to the existence of an edge between them.
* Updates the dsf tracking equivalence classes, and keeps track of
* the length of path each dot is currently a part of.
- * Returns TRUE if the dots were already linked, ie if they are part of a
+ * Returns true if the dots were already linked, ie if they are part of a
* closed loop, and false otherwise.
*/
static int merge_dots(solver_state *sstate, int edge_index)
@@ -1186,13 +1186,13 @@
j = dsf_canonify(sstate->dotdsf, j);
if (i == j) {
- return TRUE;
+ return true;
} else {
len = sstate->looplen[i] + sstate->looplen[j];
dsf_merge(sstate->dotdsf, i, j);
i = dsf_canonify(sstate->dotdsf, i);
sstate->looplen[i] = len;
- return FALSE;
+ return false;
}
}
@@ -1271,7 +1271,7 @@
static int dot_setall(solver_state *sstate, int dot,
char old_type, char new_type)
{
- int retval = FALSE, r;
+ int retval = false, r;
game_state *state = sstate->state;
grid *g;
grid_dot *d;
@@ -1278,7 +1278,7 @@
int i;
if (old_type == new_type)
- return FALSE;
+ return false;
g = state->game_grid;
d = g->dots + dot;
@@ -1287,8 +1287,8 @@
int line_index = d->edges[i] - g->edges;
if (state->lines[line_index] == old_type) {
r = solver_set_line(sstate, line_index, new_type);
- assert(r == TRUE);
- retval = TRUE;
+ assert(r == true);
+ retval = true;
}
}
return retval;
@@ -1298,7 +1298,7 @@
static int face_setall(solver_state *sstate, int face,
char old_type, char new_type)
{
- int retval = FALSE, r;
+ int retval = false, r;
game_state *state = sstate->state;
grid *g;
grid_face *f;
@@ -1305,7 +1305,7 @@
int i;
if (old_type == new_type)
- return FALSE;
+ return false;
g = state->game_grid;
f = g->faces + face;
@@ -1314,8 +1314,8 @@
int line_index = f->edges[i] - g->edges;
if (state->lines[line_index] == old_type) {
r = solver_set_line(sstate, line_index, new_type);
- assert(r == TRUE);
- retval = TRUE;
+ assert(r == true);
+ retval = true;
}
}
return retval;
@@ -1426,7 +1426,7 @@
state->clues = snewn(g->num_faces, signed char);
state->lines = snewn(g->num_edges, char);
state->line_errors = snewn(g->num_edges, unsigned char);
- state->exactly_one_loop = FALSE;
+ state->exactly_one_loop = false;
state->grid_type = params->type;
@@ -1435,7 +1435,7 @@
memset(state->lines, LINE_UNKNOWN, g->num_edges);
memset(state->line_errors, 0, g->num_edges);
- state->solved = state->cheated = FALSE;
+ state->solved = state->cheated = false;
/* Get a new random solvable board with all its clues filled in. Yes, this
* can loop for ever if the params are suitably unfavourable, but
@@ -1498,9 +1498,9 @@
state->clues = snewn(num_faces, signed char);
state->lines = snewn(num_edges, char);
state->line_errors = snewn(num_edges, unsigned char);
- state->exactly_one_loop = FALSE;
+ state->exactly_one_loop = false;
- state->solved = state->cheated = FALSE;
+ state->solved = state->cheated = false;
state->grid_type = params->type;
@@ -1659,7 +1659,7 @@
for (j = 0; j < d->order; j++) {
int e = d->edges[j] - g->edges;
if (state->lines[e] == LINE_YES)
- state->line_errors[e] = TRUE;
+ state->line_errors[e] = true;
}
/* And mark this component as not worthy of further
* consideration. */
@@ -1727,7 +1727,7 @@
-1 != largest_comp) ||
(component_state[comp] == COMP_LOOP &&
comp != largest_comp))
- state->line_errors[i] = TRUE;
+ state->line_errors[i] = true;
}
}
}
@@ -1737,12 +1737,12 @@
* If there is exactly one component and it is a loop, then
* the puzzle is potentially complete, so check the clues.
*/
- ret = TRUE;
+ ret = true;
for (i = 0; i < g->num_faces; i++) {
int c = state->clues[i];
if (c >= 0 && face_order(state, i, LINE_YES) != c) {
- ret = FALSE;
+ ret = false;
break;
}
}
@@ -1753,10 +1753,10 @@
* nothing else, which will be used to vary the semantics of
* clue highlighting at display time.
*/
- state->exactly_one_loop = TRUE;
+ state->exactly_one_loop = true;
} else {
- ret = FALSE;
- state->exactly_one_loop = FALSE;
+ ret = false;
+ state->exactly_one_loop = false;
}
sfree(component_state);
@@ -1795,7 +1795,7 @@
* A dline can be uniquely identified by an edge/dot combination, given that
* a dline-pair always goes clockwise around its common dot. The edge/dot
* combination can be represented by an edge/bool combination - if bool is
- * TRUE, use edge->dot1 else use edge->dot2. So the total number of dlines is
+ * true, use edge->dot1 else use edge->dot2. So the total number of dlines is
* exactly twice the number of edges in the grid - although the dlines
* spanning the infinite face are not all that useful to the solver.
* Note that, by convention, a dline goes clockwise around its common dot,
@@ -1912,7 +1912,7 @@
opp_dline_index = dline_index_from_dot(g, d, opp);
return set_atleastone(sstate->dlines, opp_dline_index);
}
- return FALSE;
+ return false;
}
@@ -1925,7 +1925,7 @@
* direction dir from the square in question. Similarly inv[dir] is
* whether or not the line in question is inverse to its canonical
* element. */
- int retval = FALSE;
+ int retval = false;
game_state *state = sstate->state;
grid *g = state->game_grid;
grid_face *f = g->faces + face_index;
@@ -2103,7 +2103,7 @@
current_no = sstate->face_no_count[i];
if (current_yes + current_no == f->order) {
- sstate->face_solved[i] = TRUE;
+ sstate->face_solved[i] = true;
continue;
}
@@ -2124,7 +2124,7 @@
if (state->clues[i] == current_yes) {
if (face_setall(sstate, i, LINE_UNKNOWN, LINE_NO))
diff = min(diff, DIFF_EASY);
- sstate->face_solved[i] = TRUE;
+ sstate->face_solved[i] = true;
continue;
}
@@ -2135,7 +2135,7 @@
if (f->order - state->clues[i] == current_no) {
if (face_setall(sstate, i, LINE_UNKNOWN, LINE_YES))
diff = min(diff, DIFF_EASY);
- sstate->face_solved[i] = TRUE;
+ sstate->face_solved[i] = true;
continue;
}
@@ -2207,11 +2207,11 @@
if (yes == 0) {
if (unknown == 0) {
- sstate->dot_solved[i] = TRUE;
+ sstate->dot_solved[i] = true;
} else if (unknown == 1) {
dot_setall(sstate, i, LINE_UNKNOWN, LINE_NO);
diff = min(diff, DIFF_EASY);
- sstate->dot_solved[i] = TRUE;
+ sstate->dot_solved[i] = true;
}
} else if (yes == 1) {
if (unknown == 0) {
@@ -2226,7 +2226,7 @@
dot_setall(sstate, i, LINE_UNKNOWN, LINE_NO);
diff = min(diff, DIFF_EASY);
}
- sstate->dot_solved[i] = TRUE;
+ sstate->dot_solved[i] = true;
} else {
sstate->solver_status = SOLVER_MISTAKE;
return DIFF_EASY;
@@ -2701,9 +2701,9 @@
game_state *state = sstate->state;
grid *g = state->game_grid;
int shortest_chainlen = g->num_dots;
- int loop_found = FALSE;
+ int loop_found = false;
int dots_connected;
- int progress = FALSE;
+ int progress = false;
int i;
/*
@@ -2748,7 +2748,7 @@
sstate->solver_status = SOLVER_SOLVED;
/* This discovery clearly counts as progress, even if we haven't
* just added any lines or anything */
- progress = TRUE;
+ progress = true;
goto finished_loop_deductionsing;
}
@@ -2836,7 +2836,7 @@
* make.
*/
progress = solver_set_line(sstate, i, val);
- assert(progress == TRUE);
+ assert(progress == true);
if (val == LINE_YES) {
sstate->solver_status = SOLVER_AMBIGUOUS;
goto finished_loop_deductionsing;
@@ -3099,7 +3099,7 @@
if (move[0] == 'S') {
move++;
- newstate->cheated = TRUE;
+ newstate->cheated = true;
}
while (*move) {
@@ -3126,7 +3126,7 @@
* Check for completion.
*/
if (check_completion(newstate))
- newstate->solved = TRUE;
+ newstate->solved = true;
return newstate;
@@ -3364,7 +3364,7 @@
int border = BORDER(ds->tilesize);
int i;
int flash_changed;
- int redraw_everything = FALSE;
+ int redraw_everything = false;
int edges[REDRAW_OBJECTS_LIMIT], nedges = 0;
int faces[REDRAW_OBJECTS_LIMIT], nfaces = 0;
@@ -3395,7 +3395,7 @@
*/
if (!ds->started) {
- redraw_everything = TRUE;
+ redraw_everything = true;
/*
* But we must still go through the upcoming loops, so that we
* set up stuff in ds correctly for the initial redraw.
@@ -3459,7 +3459,7 @@
ds->clue_error[i] = clue_mistake;
ds->clue_satisfied[i] = clue_satisfied;
if (nfaces == REDRAW_OBJECTS_LIMIT)
- redraw_everything = TRUE;
+ redraw_everything = true;
else
faces[nfaces++] = i;
}
@@ -3470,10 +3470,10 @@
(flashtime <= FLASH_TIME/3 ||
flashtime >= FLASH_TIME*2/3)) {
flash_changed = !ds->flashing;
- ds->flashing = TRUE;
+ ds->flashing = true;
} else {
flash_changed = ds->flashing;
- ds->flashing = FALSE;
+ ds->flashing = false;
}
/* Now, trundle through the edges. */
@@ -3484,7 +3484,7 @@
(flash_changed && state->lines[i] == LINE_YES)) {
ds->lines[i] = new_ds;
if (nedges == REDRAW_OBJECTS_LIMIT)
- redraw_everything = TRUE;
+ redraw_everything = true;
else
edges[nedges++] = i;
}
@@ -3520,7 +3520,7 @@
}
}
- ds->started = TRUE;
+ ds->started = true;
}
static float game_flash_length(const game_state *oldstate,
@@ -3648,7 +3648,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -3656,7 +3656,7 @@
dup_game,
free_game,
1, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -3673,9 +3673,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE /* wants_statusbar */,
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false /* wants_statusbar */,
+ false, game_timing_state,
0, /* mouse_priorities */
};
@@ -3697,10 +3697,10 @@
game_state *s;
char *id = NULL, *desc;
const char *err;
- int grade = FALSE;
+ int grade = false;
int ret, diff;
#if 0 /* verbose solver not supported here (yet) */
- int really_verbose = FALSE;
+ int really_verbose = false;
#endif
while (--argc > 0) {
@@ -3707,11 +3707,11 @@
char *p = *++argv;
#if 0 /* verbose solver not supported here (yet) */
if (!strcmp(p, "-v")) {
- really_verbose = TRUE;
+ really_verbose = true;
} else
#endif
if (!strcmp(p, "-g")) {
- grade = TRUE;
+ grade = true;
} else if (*p == '-') {
fprintf(stderr, "%s: unrecognised option `%s'\n", argv[0], p);
return 1;
--- a/magnets.c
+++ b/magnets.c
@@ -118,7 +118,7 @@
game_params *ret;
char buf[64];
- if (i < 0 || i >= lenof(magnets_presets)) return FALSE;
+ if (i < 0 || i >= lenof(magnets_presets)) return false;
ret = default_params();
*ret = magnets_presets[i]; /* struct copy */
@@ -130,7 +130,7 @@
magnets_presets[i].stripclues ? ", strip clues" : "");
*name = dupstr(buf);
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -601,7 +601,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1767,9 +1767,9 @@
if (((x == -1 || x == w) && y >= 0 && y < h) ||
((y == -1 || y == h) && x >= 0 && x < w))
- return TRUE;
+ return true;
- return FALSE;
+ return false;
}
static int clue_index(const game_state *state, int x, int y)
@@ -1865,7 +1865,7 @@
while (*move) {
c = *move++;
if (c == 'S') {
- ret->solved = TRUE;
+ ret->solved = true;
n = 0;
} else if (c == '+' || c == '-' ||
c == '.' || c == ' ' || c == '?') {
@@ -2286,7 +2286,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2396,7 +2396,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2403,8 +2403,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2421,9 +2421,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON, /* flags */
};
--- a/map.c
+++ b/map.c
@@ -25,9 +25,9 @@
*/
#if defined STANDALONE_SOLVER
#define SOLVER_DIAGNOSTICS
-int verbose = FALSE;
+int verbose = false;
#elif defined SOLVER_DIAGNOSTICS
-#define verbose TRUE
+#define verbose true
#endif
/*
@@ -137,7 +137,7 @@
char str[80];
if (i < 0 || i >= lenof(map_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = map_presets[i];
@@ -147,7 +147,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -706,7 +706,7 @@
* If there aren't any uncoloured vertices at all, we're done.
*/
if (nvert == 0)
- return TRUE; /* we've got a colouring! */
+ return true; /* we've got a colouring! */
/*
* Pick a random vertex in that set.
@@ -752,7 +752,7 @@
* Recurse.
*/
if (fourcolour_recurse(graph, n, ngraph, colouring, scratch, rs))
- return TRUE; /* got one! */
+ return true; /* got one! */
/*
* If that didn't work, clean up and try again with a
@@ -775,7 +775,7 @@
* violation if we get all the way back up to the top level and
* still fail.)
*/
- return FALSE;
+ return false;
}
static void fourcolour(int *graph, int n, int ngraph, int *colouring,
@@ -886,7 +886,7 @@
printf("%*scannot place %c in region %d\n", 2*sc->depth, "",
colnames[colour], index);
#endif
- return FALSE; /* can't do it */
+ return false; /* can't do it */
}
sc->possible[index] = 1 << colour;
@@ -912,7 +912,7 @@
sc->possible[k] &= ~(1 << colour);
}
- return TRUE;
+ return true;
}
#ifdef SOLVER_DIAGNOSTICS
@@ -974,7 +974,7 @@
* Now repeatedly loop until we find nothing further to do.
*/
while (1) {
- int done_something = FALSE;
+ int done_something = false;
if (difficulty < DIFF_EASY)
break; /* can't do anything at all! */
@@ -1015,7 +1015,7 @@
* friendly error code.
*/
assert(ret);
- done_something = TRUE;
+ done_something = true;
}
}
@@ -1040,7 +1040,7 @@
int j1 = graph[i] / n, j2 = graph[i] % n;
int j, k, v, v2;
#ifdef SOLVER_DIAGNOSTICS
- int started = FALSE;
+ int started = false;
#endif
if (j1 > j2)
@@ -1084,13 +1084,13 @@
printf("%*sadjacent regions %d,%d share colours"
" %s\n", 2*sc->depth, "", j1, j2,
colourset(buf, v));
- started = TRUE;
+ started = true;
printf("%*s ruling out %s in region %d\n",2*sc->depth,
"", colourset(buf, sc->possible[k] & v), k);
}
#endif
sc->possible[k] &= ~v;
- done_something = TRUE;
+ done_something = true;
}
}
}
@@ -1231,7 +1231,7 @@
}
#endif
sc->possible[k] &= ~origc;
- done_something = TRUE;
+ done_something = true;
}
}
}
@@ -1315,7 +1315,7 @@
origcolouring = snewn(n, int);
memcpy(origcolouring, colouring, n * sizeof(int));
subcolouring = snewn(n, int);
- we_already_got_one = FALSE;
+ we_already_got_one = false;
ret = 0;
for (i = 0; i < FOUR; i++) {
@@ -1359,7 +1359,7 @@
*/
if (subret == 1) {
memcpy(colouring, subcolouring, n * sizeof(int));
- we_already_got_one = TRUE;
+ we_already_got_one = true;
ret = 1;
}
@@ -1828,7 +1828,7 @@
for (i = 0; i < n; i++)
state->pencil[i] = 0;
- state->completed = state->cheated = FALSE;
+ state->completed = state->cheated = false;
state->map = snew(struct map);
state->map->refcount = 1;
@@ -1837,7 +1837,7 @@
state->map->n = n;
state->map->immutable = snewn(n, int);
for (i = 0; i < n; i++)
- state->map->immutable[i] = FALSE;
+ state->map->immutable[i] = false;
p = desc;
@@ -1863,7 +1863,7 @@
while (*p) {
if (*p >= '0' && *p < '0'+FOUR) {
state->colouring[pos] = *p - '0';
- state->map->immutable[pos] = TRUE;
+ state->map->immutable[pos] = true;
pos++;
} else {
assert(*p >= 'a' && *p <= 'z');
@@ -1889,7 +1889,7 @@
shuffle(squares, wh, sizeof(*squares), rs);
do {
- done_something = FALSE;
+ done_something = false;
for (i = 0; i < wh; i++) {
int y = squares[i] / w, x = squares[i] % w;
int c = state->map->map[y*w+x];
@@ -1920,7 +1920,7 @@
state->map->map[BE * wh + y*w+x] = bc;
state->map->map[LE * wh + y*w+x] = lc;
state->map->map[RE * wh + y*w+x] = rc;
- done_something = TRUE;
+ done_something = true;
}
}
}
@@ -2248,7 +2248,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -2279,7 +2279,7 @@
ui->dragx = ui->dragy = -1;
ui->drag_colour = -2;
ui->drag_pencil = 0;
- ui->show_numbers = FALSE;
+ ui->show_numbers = false;
ui->cur_x = ui->cur_y = ui->cur_visible = ui->cur_moved = 0;
ui->cur_lastmove = 0;
return ui;
@@ -2518,11 +2518,11 @@
int c, k, adv, i;
while (*move) {
- int pencil = FALSE;
+ int pencil = false;
c = *move;
if (c == 'p') {
- pencil = TRUE;
+ pencil = true;
c = *++move;
}
if ((c == 'C' || (c >= '0' && c < '0'+FOUR)) &&
@@ -2544,7 +2544,7 @@
}
} else if (*move == 'S') {
move++;
- ret->cheated = TRUE;
+ ret->cheated = true;
} else {
free_game(ret);
return NULL;
@@ -2562,11 +2562,11 @@
* Check for completion.
*/
if (!ret->completed) {
- int ok = TRUE;
+ int ok = true;
for (i = 0; i < n; i++)
if (ret->colouring[i] < 0) {
- ok = FALSE;
+ ok = false;
break;
}
@@ -2575,7 +2575,7 @@
int j = ret->map->graph[i] / n;
int k = ret->map->graph[i] % n;
if (ret->colouring[j] == ret->colouring[k]) {
- ok = FALSE;
+ ok = false;
break;
}
}
@@ -2582,7 +2582,7 @@
}
if (ok)
- ret->completed = TRUE;
+ ret->completed = true;
}
return ret;
@@ -2667,9 +2667,9 @@
for (i = 0; i < state->p.w * state->p.h; i++)
ds->drawn[i] = 0xFFFFL;
ds->todraw = snewn(state->p.w * state->p.h, unsigned long);
- ds->started = FALSE;
+ ds->started = false;
ds->bl = NULL;
- ds->drag_visible = FALSE;
+ ds->drag_visible = false;
ds->dragx = ds->dragy = -1;
return ds;
@@ -2857,7 +2857,7 @@
if (ds->drag_visible) {
blitter_load(dr, ds->bl, ds->dragx, ds->dragy);
draw_update(dr, ds->dragx, ds->dragy, TILESIZE + 3, TILESIZE + 3);
- ds->drag_visible = FALSE;
+ ds->drag_visible = false;
}
/*
@@ -2875,7 +2875,7 @@
COL_GRID);
draw_update(dr, 0, 0, ww, wh);
- ds->started = TRUE;
+ ds->started = true;
}
if (flashtime) {
@@ -3020,7 +3020,7 @@
cursor_y + (i*2-3) * TILESIZE/10,
TILESIZE/8, COL_0 + i, COL_0 + i);
draw_update(dr, ds->dragx, ds->dragy, TILESIZE + 3, TILESIZE + 3);
- ds->drag_visible = TRUE;
+ ds->drag_visible = true;
}
}
@@ -3055,7 +3055,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -3223,7 +3223,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -3230,8 +3230,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -3248,9 +3248,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, TRUE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, true, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
@@ -3262,8 +3262,8 @@
game_state *s;
char *id = NULL, *desc;
const char *err;
- int grade = FALSE;
- int ret, diff, really_verbose = FALSE;
+ int grade = false;
+ int ret, diff, really_verbose = false;
struct solver_scratch *sc;
int i;
@@ -3270,9 +3270,9 @@
while (--argc > 0) {
char *p = *++argv;
if (!strcmp(p, "-v")) {
- really_verbose = TRUE;
+ really_verbose = true;
} else if (!strcmp(p, "-g")) {
- grade = TRUE;
+ grade = true;
} else if (*p == '-') {
fprintf(stderr, "%s: unrecognised option `%s'\n", argv[0], p);
return 1;
--- a/matching.c
+++ b/matching.c
@@ -135,7 +135,7 @@
layer = 0;
while (1) {
- int found_free_R_vertex = FALSE;
+ int found_free_R_vertex = false;
Rqs = 0;
for (i = 0; i < Lqs; i++) {
@@ -148,7 +148,7 @@
s->Rlayer[R] = layer+1;
s->Rqueue[Rqs++] = R;
if (s->RtoL[R] == -1)
- found_free_R_vertex = TRUE;
+ found_free_R_vertex = true;
}
}
}
@@ -685,7 +685,7 @@
{
static const char stdin_identifier[] = "<standard input>";
const char *infile = NULL;
- int doing_opts = TRUE;
+ int doing_opts = true;
enum { USER_INPUT, AUTOTEST } mode = USER_INPUT;
while (--argc > 0) {
@@ -693,7 +693,7 @@
if (doing_opts && arg[0] == '-' && arg[1]) {
if (!strcmp(arg, "--")) {
- doing_opts = FALSE;
+ doing_opts = false;
} else if (!strcmp(arg, "--random")) {
char buf[64];
int len = sprintf(buf, "%lu", (unsigned long)time(NULL));
--- a/midend.c
+++ b/midend.c
@@ -167,7 +167,7 @@
me->newgame_undo.size = me->newgame_undo.len = 0;
me->newgame_redo.buf = NULL;
me->newgame_redo.size = me->newgame_redo.len = 0;
- me->newgame_can_store_undo = FALSE;
+ me->newgame_can_store_undo = false;
me->params = ourgame->default_params();
me->game_id_change_notify_function = NULL;
me->game_id_change_notify_ctx = NULL;
@@ -202,7 +202,7 @@
me->ui = NULL;
me->pressed_mouse_button = 0;
me->laststatus = NULL;
- me->timing = FALSE;
+ me->timing = false;
me->elapsed = 0.0F;
me->tilesize = me->winwidth = me->winheight = 0;
if (drapi)
@@ -315,7 +315,7 @@
/*
* Find the tile size that best fits within the given space. If
- * `user_size' is TRUE, we must actually find the _largest_ such
+ * `user_size' is true, we must actually find the _largest_ such
* tile size, in order to get as close to the user's explicit
* request as possible; otherwise, we bound above at the game's
* preferred tile size, so that the game gets what it wants
@@ -542,7 +542,7 @@
if (me->game_id_change_notify_function)
me->game_id_change_notify_function(me->game_id_change_notify_ctx);
- me->newgame_can_store_undo = TRUE;
+ me->newgame_can_store_undo = true;
}
bool midend_can_undo(midend *me)
@@ -565,11 +565,11 @@
struct newgame_undo_deserialise_read_ctx *const rctx = ctx;
if (len > rctx->len - rctx->pos)
- return FALSE;
+ return false;
memcpy(buf, rctx->ser->buf + rctx->pos, len);
rctx->pos += len;
- return TRUE;
+ return true;
}
struct newgame_undo_deserialise_check_ctx {
@@ -606,19 +606,19 @@
* We check both params and cparams, to be as safe as possible.
*/
- old = me->ourgame->encode_params(me->params, TRUE);
- new = me->ourgame->encode_params(data->params, TRUE);
+ old = me->ourgame->encode_params(me->params, true);
+ new = me->ourgame->encode_params(data->params, true);
if (strcmp(old, new)) {
/* Set a flag to distinguish this deserialise failure
* from one due to faulty decoding */
- ctx->refused = TRUE;
+ ctx->refused = true;
return "Undoing this new-game operation would change params";
}
- old = me->ourgame->encode_params(me->curparams, TRUE);
- new = me->ourgame->encode_params(data->cparams, TRUE);
+ old = me->ourgame->encode_params(me->curparams, true);
+ new = me->ourgame->encode_params(data->cparams, true);
if (strcmp(old, new)) {
- ctx->refused = TRUE;
+ ctx->refused = true;
return "Undoing this new-game operation would change params";
}
@@ -657,7 +657,7 @@
rctx.ser = &me->newgame_undo;
rctx.len = me->newgame_undo.len; /* copy for reentrancy safety */
rctx.pos = 0;
- cctx.refused = FALSE;
+ cctx.refused = false;
deserialise_error = midend_deserialise_internal(
me, newgame_undo_deserialise_read, &rctx,
newgame_undo_deserialise_check, &cctx);
@@ -730,7 +730,7 @@
rctx.ser = &me->newgame_redo;
rctx.len = me->newgame_redo.len; /* copy for reentrancy safety */
rctx.pos = 0;
- cctx.refused = FALSE;
+ cctx.refused = false;
deserialise_error = midend_deserialise_internal(
me, newgame_undo_deserialise_read, &rctx,
newgame_undo_deserialise_check, &cctx);
@@ -856,7 +856,7 @@
{
game_state *oldstate =
me->ourgame->dup_game(me->states[me->statepos - 1].state);
- int type = MOVE, gottype = FALSE, ret = TRUE;
+ int type = MOVE, gottype = false, ret = true;
float anim_time;
game_state *s;
char *movestr = NULL;
@@ -878,7 +878,7 @@
button == UI_UNDO) {
midend_stop_anim(me);
type = me->states[me->statepos-1].movetype;
- gottype = TRUE;
+ gottype = true;
if (!midend_undo(me))
goto done;
} else if (button == 'r' || button == 'R' ||
@@ -1304,7 +1304,7 @@
if (*name) {
struct preset_menu *submenu =
preset_menu_add_submenu(menu, dupstr(name));
- p = preset_menu_add_from_user_env(me, submenu, p, FALSE);
+ p = preset_menu_add_from_user_env(me, submenu, p, false);
} else {
/*
* If we get a 'close submenu' indication at the top
@@ -1320,7 +1320,7 @@
preset = me->ourgame->default_params();
me->ourgame->decode_params(preset, val);
- if (me->ourgame->validate_params(preset, TRUE)) {
+ if (me->ourgame->validate_params(preset, true)) {
/* Drop this one from the list. */
me->ourgame->free_params(preset);
continue;
@@ -1351,7 +1351,7 @@
for (i = 0; i < menu->n_entries; i++) {
if (menu->entries[i].params) {
me->encoded_presets[menu->entries[i].id] =
- me->ourgame->encode_params(menu->entries[i].params, TRUE);
+ me->ourgame->encode_params(menu->entries[i].params, true);
} else {
preset_menu_encode_params(me, menu->entries[i].submenu);
}
@@ -1406,7 +1406,7 @@
if ((e = getenv(buf)) != NULL) {
e = dupstr(e);
- preset_menu_add_from_user_env(me, me->preset_menu, e, TRUE);
+ preset_menu_add_from_user_env(me, me->preset_menu, e, true);
sfree(e);
}
}
@@ -1430,7 +1430,7 @@
int midend_which_preset(midend *me)
{
- char *encoding = me->ourgame->encode_params(me->params, TRUE);
+ char *encoding = me->ourgame->encode_params(me->params, true);
int i, ret;
ret = -1;
@@ -1652,7 +1652,7 @@
newparams = me->ourgame->dup_params(me->params);
- tmpstr = me->ourgame->encode_params(newcurparams, FALSE);
+ tmpstr = me->ourgame->encode_params(newcurparams, false);
me->ourgame->decode_params(newparams, tmpstr);
sfree(tmpstr);
@@ -1659,11 +1659,11 @@
} else {
newparams = me->ourgame->dup_params(newcurparams);
}
- free_params = TRUE;
+ free_params = true;
} else {
newcurparams = me->curparams;
newparams = me->params;
- free_params = FALSE;
+ free_params = false;
}
if (desc) {
@@ -1710,7 +1710,7 @@
sfree(par);
- me->newgame_can_store_undo = FALSE;
+ me->newgame_can_store_undo = false;
return NULL;
}
@@ -1724,7 +1724,7 @@
{
char *parstr, *ret;
- parstr = me->ourgame->encode_params(me->curparams, FALSE);
+ parstr = me->ourgame->encode_params(me->curparams, false);
assert(parstr);
assert(me->desc);
ret = snewn(strlen(parstr) + strlen(me->desc) + 2, char);
@@ -1740,7 +1740,7 @@
if (!me->seedstr)
return NULL;
- parstr = me->ourgame->encode_params(me->curparams, TRUE);
+ parstr = me->ourgame->encode_params(me->curparams, true);
assert(parstr);
ret = snewn(strlen(parstr) + strlen(me->seedstr) + 2, char);
sprintf(ret, "%s#%s", parstr, me->seedstr);
@@ -1756,7 +1756,7 @@
switch (which) {
case CFG_SETTINGS:
params = me->ourgame->custom_params(cfg);
- error = me->ourgame->validate_params(params, TRUE);
+ error = me->ourgame->validate_params(params, true);
if (error) {
me->ourgame->free_params(params);
@@ -1784,7 +1784,7 @@
if (me->ourgame->can_format_as_text_ever)
return me->ourgame->can_format_as_text_now(me->params);
else
- return FALSE;
+ return false;
}
char *midend_text_format(midend *me)
@@ -1949,7 +1949,7 @@
* The current long-term parameters structure, in full.
*/
if (me->params) {
- char *s = me->ourgame->encode_params(me->params, TRUE);
+ char *s = me->ourgame->encode_params(me->params, true);
wr("PARAMS", s);
sfree(s);
}
@@ -1958,7 +1958,7 @@
* The current short-term parameters structure, in full.
*/
if (me->curparams) {
- char *s = me->ourgame->encode_params(me->curparams, TRUE);
+ char *s = me->ourgame->encode_params(me->curparams, true);
wr("CPARAMS", s);
sfree(s);
}
@@ -1987,7 +1987,7 @@
len = strlen(me->aux_info);
s1 = snewn(len, unsigned char);
memcpy(s1, me->aux_info, len);
- obfuscate_bitmap(s1, len*8, FALSE);
+ obfuscate_bitmap(s1, len*8, false);
s2 = bin2hex(s1, len);
wr("AUXINFO", s2);
@@ -2066,7 +2066,7 @@
{
struct deserialise_data data;
int gotstates = 0;
- int started = FALSE;
+ int started = false;
int i;
char *val = NULL;
@@ -2146,7 +2146,7 @@
}
/* Now most errors are this one, unless otherwise specified */
ret = "Saved data ended unexpectedly";
- started = TRUE;
+ started = true;
} else {
if (!strcmp(key, "VERSION")) {
if (strcmp(val, SERIALISE_VERSION)) {
@@ -2183,7 +2183,7 @@
unsigned char *tmp;
int len = strlen(val) / 2; /* length in bytes */
tmp = hex2bin(val, len);
- obfuscate_bitmap(tmp, len*8, TRUE);
+ obfuscate_bitmap(tmp, len*8, true);
sfree(data.auxinfo);
data.auxinfo = snewn(len + 1, char);
@@ -2238,17 +2238,17 @@
data.params = me->ourgame->default_params();
me->ourgame->decode_params(data.params, data.parstr);
- if (me->ourgame->validate_params(data.params, TRUE)) {
+ if (me->ourgame->validate_params(data.params, true)) {
ret = "Long-term parameters in save file are invalid";
goto cleanup;
}
data.cparams = me->ourgame->default_params();
me->ourgame->decode_params(data.cparams, data.cparstr);
- if (me->ourgame->validate_params(data.cparams, FALSE)) {
+ if (me->ourgame->validate_params(data.cparams, false)) {
ret = "Short-term parameters in save file are invalid";
goto cleanup;
}
- if (data.seed && me->ourgame->validate_params(data.cparams, TRUE)) {
+ if (data.seed && me->ourgame->validate_params(data.cparams, true)) {
/*
* The seed's no use with this version, but we can perfectly
* well use the rest of the data.
@@ -2445,7 +2445,7 @@
void *rctx)
{
int nstates = 0, statepos = -1, gotstates = 0;
- int started = FALSE;
+ int started = false;
char *val = NULL;
/* Initially all errors give the same report */
@@ -2515,7 +2515,7 @@
}
/* Now most errors are this one, unless otherwise specified */
ret = "Saved data ended unexpectedly";
- started = TRUE;
+ started = true;
} else {
if (!strcmp(key, "VERSION")) {
if (strcmp(val, SERIALISE_VERSION)) {
--- a/mines.c
+++ b/mines.c
@@ -97,19 +97,19 @@
ret->w = ret->h = 9;
ret->n = 10;
- ret->unique = TRUE;
+ ret->unique = true;
return ret;
}
static const struct game_params mines_presets[] = {
- {9, 9, 10, TRUE},
- {9, 9, 35, TRUE},
- {16, 16, 40, TRUE},
- {16, 16, 99, TRUE},
+ {9, 9, 10, true},
+ {9, 9, 35, true},
+ {16, 16, 40, true},
+ {16, 16, 99, true},
#ifndef SMALL_SCREEN
- {30, 16, 99, TRUE},
- {30, 16, 170, TRUE},
+ {30, 16, 99, true},
+ {30, 16, 170, true},
#endif
};
@@ -119,7 +119,7 @@
char str[80];
if (i < 0 || i >= lenof(mines_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = mines_presets[i];
@@ -128,7 +128,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -167,7 +167,7 @@
while (*p) {
if (*p == 'a') {
p++;
- params->unique = FALSE;
+ params->unique = false;
} else
p++; /* skip any other gunk */
}
@@ -401,7 +401,7 @@
ss->todo_head = s;
ss->todo_tail = s;
s->next = NULL;
- s->todo = TRUE;
+ s->todo = true;
}
static void ss_add(struct setstore *ss, int x, int y, int mask, int mines)
@@ -427,7 +427,7 @@
s->y = y;
s->mask = mask;
s->mines = mines;
- s->todo = FALSE;
+ s->todo = false;
if (add234(ss->sets, s) != s) {
/*
* This set already existed! Free it and return.
@@ -463,7 +463,7 @@
else if (s == ss->todo_tail)
ss->todo_tail = prev;
- s->todo = FALSE;
+ s->todo = false;
/*
* Remove s from the tree.
@@ -507,7 +507,7 @@
* really overlap, and add it to the list if
* so.
*/
- if (setmunge(x, y, mask, s->x, s->y, s->mask, FALSE)) {
+ if (setmunge(x, y, mask, s->x, s->y, s->mask, false)) {
/*
* There's an overlap.
*/
@@ -542,7 +542,7 @@
else
ss->todo_tail = NULL;
ret->next = ret->prev = NULL;
- ret->todo = FALSE;
+ ret->todo = false;
return ret;
} else {
return NULL;
@@ -671,7 +671,7 @@
* Main deductive loop.
*/
while (1) {
- int done_something = FALSE;
+ int done_something = false;
struct set *s;
/*
@@ -740,7 +740,7 @@
* Compute the mask for this set minus the
* newly known square.
*/
- newmask = setmunge(s->x, s->y, s->mask, x, y, 1, TRUE);
+ newmask = setmunge(s->x, s->y, s->mask, x, y, 1, true);
/*
* Compute the new mine count.
@@ -768,7 +768,7 @@
* Marking a fresh square as known certainly counts as
* doing something.
*/
- done_something = TRUE;
+ done_something = true;
}
/*
@@ -825,9 +825,9 @@
* s2-s.
*/
swing = setmunge(s->x, s->y, s->mask, s2->x, s2->y, s2->mask,
- TRUE);
+ true);
s2wing = setmunge(s2->x, s2->y, s2->mask, s->x, s->y, s->mask,
- TRUE);
+ true);
swc = bitcount16(swing);
s2wc = bitcount16(s2wing);
@@ -874,7 +874,7 @@
* _something_, even if it's only reducing the size of
* our to-do list.
*/
- done_something = TRUE;
+ done_something = true;
} else if (n >= 0) {
/*
* We have nothing left on our todo list, which means
@@ -1015,7 +1015,7 @@
while (1) {
if (cursor < nsets) {
- int ok = TRUE;
+ int ok = true;
/* See if any existing set overlaps this one. */
for (i = 0; i < cursor; i++)
@@ -1024,8 +1024,8 @@
sets[cursor]->y,
sets[cursor]->mask,
sets[i]->x, sets[i]->y, sets[i]->mask,
- FALSE)) {
- ok = FALSE;
+ false)) {
+ ok = false;
break;
}
@@ -1065,7 +1065,7 @@
*/
for (i = 0; i < w*h; i++)
if (grid[i] == -2) {
- int outside = TRUE;
+ int outside = true;
y = i / w;
x = i % w;
for (j = 0; j < nsets; j++)
@@ -1072,8 +1072,8 @@
if (setused[j] &&
setmunge(sets[j]->x, sets[j]->y,
sets[j]->mask, x, y, 1,
- FALSE)) {
- outside = FALSE;
+ false)) {
+ outside = false;
break;
}
if (outside)
@@ -1082,7 +1082,7 @@
x, y, 1, minesleft != 0);
}
- done_something = TRUE;
+ done_something = true;
break; /* return to main deductive loop */
}
@@ -1728,7 +1728,7 @@
int ntries = 0;
do {
- success = FALSE;
+ success = false;
ntries++;
memset(ret, 0, w*h);
@@ -1814,10 +1814,10 @@
solveret =
minesolve(w, h, n, solvegrid, mineopen, mineperturb, ctx, rs);
if (solveret < 0 || (prevret >= 0 && solveret >= prevret)) {
- success = FALSE;
+ success = false;
break;
} else if (solveret == 0) {
- success = TRUE;
+ success = true;
break;
}
}
@@ -1824,7 +1824,7 @@
sfree(solvegrid);
} else {
- success = TRUE;
+ success = true;
}
} while (!success);
@@ -1849,7 +1849,7 @@
bmp[i / 8] |= 0x80 >> (i % 8);
}
if (obfuscate)
- obfuscate_bitmap(bmp, area, FALSE);
+ obfuscate_bitmap(bmp, area, false);
/*
* Now encode the resulting bitmap in hex. We can work to
@@ -1879,7 +1879,7 @@
char *grid;
#ifdef TEST_OBFUSCATION
- static int tested_obfuscation = FALSE;
+ static int tested_obfuscation = false;
if (!tested_obfuscation) {
/*
* A few simple test vectors for the obfuscator.
@@ -1895,10 +1895,10 @@
*/
{
unsigned char bmp1[] = "\x12\x34\x56\x70";
- obfuscate_bitmap(bmp1, 28, FALSE);
+ obfuscate_bitmap(bmp1, 28, false);
printf("test 1 encode: %s\n",
memcmp(bmp1, "\x07\xfa\x65\x00", 4) ? "failed" : "passed");
- obfuscate_bitmap(bmp1, 28, TRUE);
+ obfuscate_bitmap(bmp1, 28, true);
printf("test 1 decode: %s\n",
memcmp(bmp1, "\x12\x34\x56\x70", 4) ? "failed" : "passed");
}
@@ -1912,7 +1912,7 @@
unsigned char bmp2a[50];
memset(bmp2, 0, 50);
memset(bmp2a, 0, 50);
- obfuscate_bitmap(bmp2, 50 * 8, FALSE);
+ obfuscate_bitmap(bmp2, 50 * 8, false);
/*
* SHA of twenty-five zero bytes plus "0" is
* b202c07b990c01f6ff2d544707f60e506019b671. SHA of
@@ -1934,7 +1934,7 @@
"\xb5\xa2\x10\xb0\xaf\x91\x3d\xb8\x5d\x37\xca\x27"
"\xf5\x2a\x9f\x78\xbb\xa3\xa8\x00\x30\xdb\x3d\x01"
"\xd8\xdf\x78", 50) ? "failed" : "passed");
- obfuscate_bitmap(bmp2, 50 * 8, TRUE);
+ obfuscate_bitmap(bmp2, 50 * 8, true);
printf("test 2 decode: %s\n",
memcmp(bmp2, bmp2a, 50) ? "failed" : "passed");
}
@@ -1944,7 +1944,7 @@
grid = minegen(w, h, n, x, y, unique, rs);
if (game_desc)
- *game_desc = describe_layout(grid, w * h, x, y, TRUE);
+ *game_desc = describe_layout(grid, w * h, x, y, true);
return grid;
}
@@ -2079,7 +2079,7 @@
* mine that killed them, but not the rest (in case they
* want to Undo and carry on playing).
*/
- state->dead = TRUE;
+ state->dead = true;
state->grid[y*w+x] = 65;
return -1;
}
@@ -2099,7 +2099,7 @@
* using repeated N^2 scans of the grid.
*/
while (1) {
- int done_something = FALSE;
+ int done_something = false;
for (yy = 0; yy < h; yy++)
for (xx = 0; xx < w; xx++)
@@ -2128,7 +2128,7 @@
state->grid[(yy+dy)*w+(xx+dx)] = -10;
}
- done_something = TRUE;
+ done_something = true;
}
if (!done_something)
@@ -2155,7 +2155,7 @@
if (state->grid[yy*w+xx] < 0)
state->grid[yy*w+xx] = -1;
}
- state->won = TRUE;
+ state->won = true;
}
return 0;
@@ -2171,8 +2171,8 @@
state->w = params->w;
state->h = params->h;
state->n = params->n;
- state->dead = state->won = FALSE;
- state->used_solve = FALSE;
+ state->dead = state->won = false;
+ state->used_solve = false;
wh = state->w * state->h;
@@ -2190,9 +2190,9 @@
desc++; /* skip over mine count */
if (*desc) desc++; /* eat comma */
if (*desc == 'a')
- state->layout->unique = FALSE;
+ state->layout->unique = false;
else
- state->layout->unique = TRUE;
+ state->layout->unique = true;
desc++;
if (*desc) desc++; /* eat comma */
@@ -2219,7 +2219,7 @@
}
if (*desc == 'm') {
- masked = TRUE;
+ masked = true;
desc++;
} else {
if (*desc == 'u')
@@ -2228,7 +2228,7 @@
* We permit game IDs to be entered by hand without the
* masking transformation.
*/
- masked = FALSE;
+ masked = false;
}
bmp = snewn((wh + 7) / 8, unsigned char);
@@ -2251,7 +2251,7 @@
}
if (masked)
- obfuscate_bitmap(bmp, wh, TRUE);
+ obfuscate_bitmap(bmp, wh, true);
memset(state->layout->mines, 0, wh);
for (i = 0; i < wh; i++) {
@@ -2310,7 +2310,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -2355,8 +2355,8 @@
ui->hx = ui->hy = -1;
ui->hradius = ui->validradius = 0;
ui->deaths = 0;
- ui->completed = FALSE;
- ui->flash_is_death = FALSE; /* *shrug* */
+ ui->completed = false;
+ ui->flash_is_death = false; /* *shrug* */
ui->cur_x = ui->cur_y = ui->cur_visible = 0;
return ui;
}
@@ -2384,7 +2384,7 @@
int p= 0;
sscanf(encoding, "D%d%n", &ui->deaths, &p);
if (encoding[p] == 'C')
- ui->completed = TRUE;
+ ui->completed = true;
}
static void game_changed_state(game_ui *ui, const game_state *oldstate,
@@ -2391,7 +2391,7 @@
const game_state *newstate)
{
if (newstate->won)
- ui->completed = TRUE;
+ ui->completed = true;
}
struct game_drawstate {
@@ -2643,7 +2643,7 @@
}
}
}
- ret->used_solve = TRUE;
+ ret->used_solve = true;
return ret;
} else {
@@ -2797,7 +2797,7 @@
ds->w = state->w;
ds->h = state->h;
- ds->started = FALSE;
+ ds->started = false;
ds->tilesize = 0; /* not decided yet */
ds->grid = snewn(ds->w * ds->h, signed char);
ds->bg = -1;
@@ -2996,7 +2996,7 @@
coords[0] = COORD(0) - OUTER_HIGHLIGHT_WIDTH;
draw_polygon(dr, coords, 5, COL_LOWLIGHT, COL_LOWLIGHT);
- ds->started = TRUE;
+ ds->started = true;
}
if (ui->cur_visible) cx = ui->cur_x;
@@ -3130,11 +3130,11 @@
if (dir > 0 && !oldstate->dead && !oldstate->won) {
if (newstate->dead) {
- ui->flash_is_death = TRUE;
+ ui->flash_is_death = true;
return 3 * FLASH_FRAME;
}
if (newstate->won) {
- ui->flash_is_death = FALSE;
+ ui->flash_is_death = false;
return 2 * FLASH_FRAME;
}
}
@@ -3154,8 +3154,8 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
if (state->dead || state->won || ui->completed || !state->layout->mines)
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -3178,7 +3178,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -3185,8 +3185,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -3203,9 +3203,9 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- TRUE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ true, game_timing_state,
BUTTON_BEATS(LEFT_BUTTON, RIGHT_BUTTON) | REQUIRE_RBUTTON,
};
--- a/nestedvm.c
+++ b/nestedvm.c
@@ -216,7 +216,7 @@
int x, y;
x = width;
y = height;
- midend_size(fe->me, &x, &y, TRUE);
+ midend_size(fe->me, &x, &y, true);
fe->ox = (width - x) / 2;
fe->oy = (height - y) / 2;
fe->w = x;
@@ -244,7 +244,7 @@
{
if (fe->timer_active)
_call_java(4, 13, 0, 0);
- fe->timer_active = FALSE;
+ fe->timer_active = false;
}
void activate_timer(frontend *fe)
@@ -253,7 +253,7 @@
_call_java(4, 12, 0, 0);
gettimeofday(&fe->last_time, NULL);
}
- fe->timer_active = TRUE;
+ fe->timer_active = true;
}
void jcallback_config_ok()
@@ -266,7 +266,7 @@
if (err)
_call_java(2, (int) "Error", (int)err, 1);
else {
- fe->cfgret = TRUE;
+ fe->cfgret = true;
}
}
@@ -282,7 +282,7 @@
void jcallback_config_set_boolean(int item_ptr, int selected) {
config_item *i = (config_item *)item_ptr;
assert(i->type == C_BOOLEAN);
- i->u.boolean.bval = selected != 0 ? TRUE : FALSE;
+ i->u.boolean.bval = selected != 0 ? true : false;
}
void jcallback_config_set_choice(int item_ptr, int selected) {
@@ -297,7 +297,7 @@
config_item *i;
fe->cfg = midend_get_config(fe->me, which, &title);
fe->cfg_which = which;
- fe->cfgret = FALSE;
+ fe->cfgret = false;
_call_java(10, (int)title, 0, 0);
for (i = fe->cfg; i->type != C_END; i++) {
_call_java(5, (int)i, i->type, (int)i->name);
@@ -357,7 +357,7 @@
x = INT_MAX;
y = INT_MAX;
- midend_size(fe->me, &x, &y, FALSE);
+ midend_size(fe->me, &x, &y, false);
_call_java(3, x, y, 0);
}
@@ -443,7 +443,7 @@
float* colours;
_fe = snew(frontend);
- _fe->timer_active = FALSE;
+ _fe->timer_active = false;
_fe->me = midend_new(_fe, &thegame, &nestedvm_drawing, _fe);
if (argc > 1)
midend_game_id(_fe->me, argv[1]); /* ignore failure */
--- a/net.c
+++ b/net.c
@@ -154,8 +154,8 @@
ret->width = 5;
ret->height = 5;
- ret->wrapping = FALSE;
- ret->unique = TRUE;
+ ret->wrapping = false;
+ ret->unique = true;
ret->barrier_probability = 0.0;
return ret;
@@ -162,19 +162,19 @@
}
static const struct game_params net_presets[] = {
- {5, 5, FALSE, TRUE, 0.0},
- {7, 7, FALSE, TRUE, 0.0},
- {9, 9, FALSE, TRUE, 0.0},
- {11, 11, FALSE, TRUE, 0.0},
+ {5, 5, false, true, 0.0},
+ {7, 7, false, true, 0.0},
+ {9, 9, false, true, 0.0},
+ {11, 11, false, true, 0.0},
#ifndef SMALL_SCREEN
- {13, 11, FALSE, TRUE, 0.0},
+ {13, 11, false, true, 0.0},
#endif
- {5, 5, TRUE, TRUE, 0.0},
- {7, 7, TRUE, TRUE, 0.0},
- {9, 9, TRUE, TRUE, 0.0},
- {11, 11, TRUE, TRUE, 0.0},
+ {5, 5, true, true, 0.0},
+ {7, 7, true, true, 0.0},
+ {9, 9, true, true, 0.0},
+ {11, 11, true, true, 0.0},
#ifndef SMALL_SCREEN
- {13, 11, TRUE, TRUE, 0.0},
+ {13, 11, true, true, 0.0},
#endif
};
@@ -184,7 +184,7 @@
char str[80];
if (i < 0 || i >= lenof(net_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = net_presets[i];
@@ -194,7 +194,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -226,7 +226,7 @@
while (*p) {
if (*p == 'w') {
p++;
- ret->wrapping = TRUE;
+ ret->wrapping = true;
} else if (*p == 'b') {
p++;
ret->barrier_probability = (float)atof(p);
@@ -233,7 +233,7 @@
while (*p && (*p == '.' || isdigit((unsigned char)*p))) p++;
} else if (*p == 'a') {
p++;
- ret->unique = FALSE;
+ ret->unique = false;
} else
p++; /* skip any other gunk */
}
@@ -424,7 +424,7 @@
{
if (todo->marked[index])
return; /* already on the list */
- todo->marked[index] = TRUE;
+ todo->marked[index] = true;
todo->buffer[todo->tail++] = index;
if (todo->tail == todo->buflen)
todo->tail = 0;
@@ -438,7 +438,7 @@
ret = todo->buffer[todo->head++];
if (todo->head == todo->buflen)
todo->head = 0;
- todo->marked[ret] = FALSE;
+ todo->marked[ret] = false;
return ret;
}
@@ -591,7 +591,7 @@
/*
* Main deductive loop.
*/
- done_something = TRUE; /* prevent instant termination! */
+ done_something = true; /* prevent instant termination! */
while (1) {
int index;
@@ -605,8 +605,8 @@
* have no choice but to scan the whole grid for
* longer-range things we've missed. Hence, I now add
* every square on the grid back on to the to-do list.
- * I also set `done_something' to FALSE at this point;
- * if we later come back here and find it still FALSE,
+ * I also set `done_something' to false at this point;
+ * if we later come back here and find it still false,
* we will know we've scanned the entire grid without
* finding anything new to do, and we can terminate.
*/
@@ -614,7 +614,7 @@
break;
for (i = 0; i < w*h; i++)
todo_add(todo, i);
- done_something = FALSE;
+ done_something = false;
index = todo_get(todo);
}
@@ -633,7 +633,7 @@
int nequiv, equiv[5];
int val = tilestate[(y*w+x) * 4 + i];
- valid = TRUE;
+ valid = true;
nnondeadends = deadendtotal = 0;
equiv[0] = ourclass;
nequiv = 1;
@@ -644,7 +644,7 @@
*/
if ((edgestate[(y*w+x) * 5 + d] == 1 && !(val & d)) ||
(edgestate[(y*w+x) * 5 + d] == 2 && (val & d)))
- valid = FALSE;
+ valid = false;
if (val & d) {
/*
@@ -672,7 +672,7 @@
if (k == nequiv)
equiv[nequiv++] = c;
else
- valid = FALSE;
+ valid = false;
}
}
}
@@ -689,7 +689,7 @@
* with a total area of 6, not 5.)
*/
if (deadendtotal > 0 && deadendtotal+1 < area)
- valid = FALSE;
+ valid = false;
} else if (nnondeadends == 1) {
/*
* If this orientation links together one or
@@ -729,7 +729,7 @@
}
if (j < i) {
- done_something = TRUE;
+ done_something = true;
/*
* We have ruled out at least one tile orientation.
@@ -764,7 +764,7 @@
edgestate[(y*w+x) * 5 + d] = 1;
edgestate[(y2*w+x2) * 5 + d2] = 1;
dsf_merge(equivalence, y*w+x, y2*w+x2);
- done_something = TRUE;
+ done_something = true;
todo_add(todo, y2*w+x2);
} else if (!(o & d)) {
/* This edge is closed in all orientations. */
@@ -773,7 +773,7 @@
#endif
edgestate[(y*w+x) * 5 + d] = 2;
edgestate[(y2*w+x2) * 5 + d2] = 2;
- done_something = TRUE;
+ done_something = true;
todo_add(todo, y2*w+x2);
}
}
@@ -795,7 +795,7 @@
x2, y2, d2, deadendmax[d]);
#endif
deadends[(y2*w+x2) * 5 + d2] = deadendmax[d];
- done_something = TRUE;
+ done_something = true;
todo_add(todo, y2*w+x2);
}
}
@@ -1640,7 +1640,7 @@
state->imm = snew(game_immutable_state);
state->imm->refcount = 1;
state->last_rotate_dir = state->last_rotate_x = state->last_rotate_y = 0;
- state->completed = state->used_solve = FALSE;
+ state->completed = state->used_solve = false;
state->tiles = snewn(state->width * state->height, unsigned char);
memset(state->tiles, 0, state->width * state->height);
state->imm->barriers = snewn(state->width * state->height, unsigned char);
@@ -1696,15 +1696,15 @@
* description of a non-wrapping game. This is so that we
* can change some aspects of the UI behaviour.
*/
- state->wrapping = FALSE;
+ state->wrapping = false;
for (x = 0; x < state->width; x++)
if (!(barrier(state, x, 0) & U) ||
!(barrier(state, x, state->height-1) & D))
- state->wrapping = TRUE;
+ state->wrapping = true;
for (y = 0; y < state->height; y++)
if (!(barrier(state, 0, y) & L) ||
!(barrier(state, state->width-1, y) & R))
- state->wrapping = TRUE;
+ state->wrapping = true;
}
return state;
@@ -1846,7 +1846,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -2015,7 +2015,7 @@
ui->org_x = ui->org_y = 0;
ui->cur_x = ui->cx = state->width / 2;
ui->cur_y = ui->cy = state->height / 2;
- ui->cur_visible = FALSE;
+ ui->cur_visible = false;
get_random_seed(&seed, &seedsize);
ui->rs = random_new(seed, seedsize);
sfree(seed);
@@ -2088,7 +2088,7 @@
button == RIGHT_BUTTON) {
if (ui->cur_visible) {
- ui->cur_visible = FALSE;
+ ui->cur_visible = false;
nullret = UI_UPDATE;
}
@@ -2133,7 +2133,7 @@
ui->dragtiley = ty;
ui->dragstartx = x % TILE_SIZE;
ui->dragstarty = y % TILE_SIZE;
- ui->dragged = FALSE;
+ ui->dragged = false;
return nullret; /* no actual action */
} else if (button == LEFT_DRAG
#ifndef STYLUS_BASED
@@ -2176,17 +2176,17 @@
action = ROTATE_180;
ui->dragstartx = xF;
ui->dragstarty = yF;
- ui->dragged = TRUE;
+ ui->dragged = true;
} else if (dA == dmin) {
action = ROTATE_LEFT;
ui->dragstartx = xA;
ui->dragstarty = yA;
- ui->dragged = TRUE;
+ ui->dragged = true;
} else /* dC == dmin */ {
action = ROTATE_RIGHT;
ui->dragstartx = xC;
ui->dragstarty = yC;
- ui->dragged = TRUE;
+ ui->dragged = true;
}
} else if (button == LEFT_RELEASE
#ifndef STYLUS_BASED
@@ -2242,7 +2242,7 @@
action = ROTATE_RIGHT;
else if (button == 'f' || button == 'F')
action = ROTATE_180;
- ui->cur_visible = TRUE;
+ ui->cur_visible = true;
} else if (button == 'j' || button == 'J') {
/* XXX should we have some mouse control for this? */
action = JUMBLE;
@@ -2327,7 +2327,7 @@
}
if (action == MOVE_CURSOR) {
OFFSET(ui->cur_x, ui->cur_y, ui->cur_x, ui->cur_y, dir, state);
- ui->cur_visible = TRUE;
+ ui->cur_visible = true;
}
return UI_UPDATE;
} else {
@@ -2344,14 +2344,14 @@
if (move[0] == 'J' || move[0] == 'S') {
if (move[0] == 'S')
- ret->used_solve = TRUE;
+ ret->used_solve = true;
move++;
if (*move == ';')
move++;
- noanim = TRUE;
+ noanim = true;
} else
- noanim = FALSE;
+ noanim = false;
ret->last_rotate_dir = 0; /* suppress animation */
ret->last_rotate_x = ret->last_rotate_y = 0;
@@ -2403,7 +2403,7 @@
{
unsigned char *active;
int pos;
- int complete = TRUE;
+ int complete = true;
for (pos = 0; pos < ret->width * ret->height; pos++)
if (ret->tiles[pos] & 0xF)
@@ -2414,7 +2414,7 @@
for (pos = 0; pos < ret->width * ret->height; pos++)
if ((ret->tiles[pos] & 0xF) && !active[pos]) {
- complete = FALSE;
+ complete = false;
break;
}
@@ -2422,7 +2422,7 @@
}
if (complete)
- ret->completed = TRUE;
+ ret->completed = true;
}
return ret;
@@ -2438,7 +2438,7 @@
game_drawstate *ds = snew(game_drawstate);
int i, ncells;
- ds->started = FALSE;
+ ds->started = false;
ds->width = state->width;
ds->height = state->height;
ncells = (state->width+2) * (state->height+2);
@@ -2571,7 +2571,7 @@
float fpoints[12*2];
int points[12*2];
int npoints, d, dsh, i;
- int any_wire_this_colour = FALSE;
+ int any_wire_this_colour = false;
float xf, yf;
npoints = 0;
@@ -2590,7 +2590,7 @@
fpoints[2*npoints+1] = radius * Y(d) + halfwidth * Y(A(d));
npoints++;
- any_wire_this_colour = TRUE;
+ any_wire_this_colour = true;
}
}
@@ -2842,7 +2842,7 @@
int w, h;
game_params params;
- ds->started = TRUE;
+ ds->started = true;
params.width = ds->width;
params.height = ds->height;
@@ -3005,7 +3005,7 @@
{
char statusbuf[256], *p;
int i, n, n2, a;
- int complete = FALSE;
+ int complete = false;
p = statusbuf;
*p = '\0'; /* ensure even an empty status string is terminated */
@@ -3012,10 +3012,10 @@
if (state->used_solve) {
p += sprintf(p, "Auto-solved. ");
- complete = TRUE;
+ complete = true;
} else if (state->completed) {
p += sprintf(p, "COMPLETED! ");
- complete = TRUE;
+ complete = true;
}
/*
@@ -3091,7 +3091,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -3220,12 +3220,12 @@
/*
* Draw the top left corner diagram.
*/
- draw_diagram(dr, ds, x, y, TRUE, vx, TRUE, ink);
+ draw_diagram(dr, ds, x, y, true, vx, true, ink);
/*
* Draw the real solution diagram, if we're doing so.
*/
- draw_diagram(dr, ds, x, y, FALSE, v, locked, ink);
+ draw_diagram(dr, ds, x, y, false, v, locked, ink);
}
}
@@ -3241,7 +3241,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -3248,8 +3248,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -3266,8 +3266,8 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/netslide.c
+++ b/netslide.c
@@ -150,7 +150,7 @@
ret->width = 3;
ret->height = 3;
- ret->wrapping = FALSE;
+ ret->wrapping = false;
ret->barrier_probability = 1.0;
ret->movetarget = 0;
@@ -159,15 +159,15 @@
static const struct { int x, y, wrap, bprob; const char* desc; }
netslide_presets[] = {
- {3, 3, FALSE, 1, " easy"},
- {3, 3, FALSE, 0, " medium"},
- {3, 3, TRUE, 0, " hard"},
- {4, 4, FALSE, 1, " easy"},
- {4, 4, FALSE, 0, " medium"},
- {4, 4, TRUE, 0, " hard"},
- {5, 5, FALSE, 1, " easy"},
- {5, 5, FALSE, 0, " medium"},
- {5, 5, TRUE, 0, " hard"},
+ {3, 3, false, 1, " easy"},
+ {3, 3, false, 0, " medium"},
+ {3, 3, true, 0, " hard"},
+ {4, 4, false, 1, " easy"},
+ {4, 4, false, 0, " medium"},
+ {4, 4, true, 0, " hard"},
+ {5, 5, false, 1, " easy"},
+ {5, 5, false, 0, " medium"},
+ {5, 5, true, 0, " hard"},
};
static bool game_fetch_preset(int i, char **name, game_params **params)
@@ -176,7 +176,7 @@
char str[80];
if (i < 0 || i >= lenof(netslide_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
ret->width = netslide_presets[i].x;
@@ -189,7 +189,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -208,7 +208,7 @@
{
char const *p = string;
- ret->wrapping = FALSE;
+ ret->wrapping = false;
ret->barrier_probability = 0.0;
ret->movetarget = 0;
@@ -739,7 +739,7 @@
state->wrapping = params->wrapping;
state->movetarget = params->movetarget;
state->completed = 0;
- state->used_solve = FALSE;
+ state->used_solve = false;
state->move_count = 0;
state->last_move_row = -1;
state->last_move_col = -1;
@@ -806,25 +806,25 @@
for (dir = 1; dir < 0x10; dir <<= 1) {
int dir2 = A(dir);
int x1, y1, x2, y2, x3, y3;
- int corner = FALSE;
+ int corner = false;
if (!(barrier(state, x, y) & dir))
continue;
if (barrier(state, x, y) & dir2)
- corner = TRUE;
+ corner = true;
x1 = x + X(dir), y1 = y + Y(dir);
if (x1 >= 0 && x1 < state->width &&
y1 >= 0 && y1 < state->height &&
(barrier(state, x1, y1) & dir2))
- corner = TRUE;
+ corner = true;
x2 = x + X(dir2), y2 = y + Y(dir2);
if (x2 >= 0 && x2 < state->width &&
y2 >= 0 && y2 < state->height &&
(barrier(state, x2, y2) & dir))
- corner = TRUE;
+ corner = true;
if (corner) {
barrier(state, x, y) |= (dir << 4);
@@ -891,7 +891,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -975,7 +975,7 @@
game_ui *ui = snew(game_ui);
ui->cur_x = 0;
ui->cur_y = -1;
- ui->cur_visible = FALSE;
+ ui->cur_visible = false;
return ui;
}
@@ -1135,7 +1135,7 @@
strlen(move) == from->width * from->height + 1) {
int i;
ret = dup_game(from);
- ret->used_solve = TRUE;
+ ret->used_solve = true;
ret->completed = ret->move_count = 1;
for (i = 0; i < from->width * from->height; i++) {
@@ -1174,12 +1174,12 @@
if (!ret->completed) {
unsigned char *active = compute_active(ret, -1, -1);
int x1, y1;
- int complete = TRUE;
+ int complete = true;
for (x1 = 0; x1 < ret->width; x1++)
for (y1 = 0; y1 < ret->height; y1++)
if (!index(ret, active, x1, y1)) {
- complete = FALSE;
+ complete = false;
goto break_label; /* break out of two loops at once */
}
break_label:
@@ -1201,7 +1201,7 @@
{
game_drawstate *ds = snew(game_drawstate);
- ds->started = FALSE;
+ ds->started = false;
ds->width = state->width;
ds->height = state->height;
ds->visible = snewn(state->width * state->height, unsigned char);
@@ -1593,7 +1593,7 @@
if (!ds->started) {
int phase;
- ds->started = TRUE;
+ ds->started = true;
draw_rect(dr, 0, 0,
BORDER * 2 + WINDOW_OFFSET * 2 + TILE_SIZE * state->width + TILE_BORDER,
@@ -1830,7 +1830,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return FALSE;
+ return false;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1853,7 +1853,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1860,8 +1860,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1878,9 +1878,9 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/nullgame.c
+++ b/nullgame.c
@@ -44,7 +44,7 @@
static bool game_fetch_preset(int i, char **name, game_params **params)
{
- return FALSE;
+ return false;
}
static void free_params(game_params *params)
@@ -126,7 +126,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -249,7 +249,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -272,7 +272,7 @@
encode_params,
free_params,
dup_params,
- FALSE, game_configure, custom_params,
+ false, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -279,8 +279,8 @@
new_game,
dup_game,
free_game,
- FALSE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ false, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -297,8 +297,8 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/obfusc.c
+++ b/obfusc.c
@@ -37,7 +37,7 @@
unsigned char *data;
int datalen;
int decode = -1;
- int doing_opts = TRUE;
+ int doing_opts = true;
while (--argc > 0) {
char *p = *++argv;
--- a/palisade.c
+++ b/palisade.c
@@ -77,13 +77,13 @@
static bool game_fetch_preset(int i, char **name, game_params **params)
{
- if (i < 0 || i >= lenof(presets)) return FALSE;
+ if (i < 0 || i >= lenof(presets)) return false;
*params = clone(&presets[i]);
*name = string(60, "%d x %d, regions of size %d",
presets[i].w, presets[i].h, presets[i].k);
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -315,7 +315,7 @@
ctx->params->k != 2))
{
disconnect(ctx, i, j, dir);
- /* changed = TRUE, but this is a one-shot... */
+ /* changed = true, but this is a one-shot... */
}
}
}
@@ -324,7 +324,7 @@
static int solver_number_exhausted(solver_ctx *ctx)
{
int w = ctx->params->w, h = ctx->params->h, wh = w*h, i, dir, off;
- int changed = FALSE;
+ int changed = false;
for (i = 0; i < wh; ++i) {
if (ctx->clues[i] == EMPTY) continue;
@@ -334,7 +334,7 @@
int j = i + dx[dir] + w*dy[dir];
if (!maybe(ctx, i, j, dir)) continue;
connect(ctx, i, j);
- changed = TRUE;
+ changed = true;
}
continue;
}
@@ -350,7 +350,7 @@
int j = i + dx[dir] + w*dy[dir];
if (!maybe(ctx, i, j, dir)) continue;
disconnect(ctx, i, j, dir);
- changed = TRUE;
+ changed = true;
}
}
@@ -360,7 +360,7 @@
static int solver_not_too_big(solver_ctx *ctx)
{
int w = ctx->params->w, h = ctx->params->h, wh = w*h, i, dir;
- int changed = FALSE;
+ int changed = false;
for (i = 0; i < wh; ++i) {
int size = dsf_size(ctx->dsf, i);
@@ -369,7 +369,7 @@
if (!maybe(ctx, i, j, dir)) continue;
if (size + dsf_size(ctx->dsf, j) <= ctx->params->k) continue;
disconnect(ctx, i, j, dir);
- changed = TRUE;
+ changed = true;
}
}
@@ -379,7 +379,7 @@
static int solver_not_too_small(solver_ctx *ctx)
{
int w = ctx->params->w, h = ctx->params->h, wh = w*h, i, dir;
- int *outs, k = ctx->params->k, ci, changed = FALSE;
+ int *outs, k = ctx->params->k, ci, changed = false;
snewa(outs, wh);
setmem(outs, -1, wh);
@@ -400,7 +400,7 @@
if (i != dsf_canonify(ctx->dsf, i)) continue;
if (j < 0) continue;
connect(ctx, i, j); /* only one place for i to grow */
- changed = TRUE;
+ changed = true;
}
sfree(outs);
@@ -410,7 +410,7 @@
static int solver_no_dangling_edges(solver_ctx *ctx)
{
int w = ctx->params->w, h = ctx->params->h, r, c;
- int changed = FALSE;
+ int changed = false;
/* for each vertex */
for (r = 1; r < h; ++r)
@@ -435,7 +435,7 @@
if (4 - noline == 1) {
assert (e != -1);
disconnect(ctx, e, COMPUTE_J, de);
- changed = TRUE;
+ changed = true;
continue;
}
@@ -447,11 +447,11 @@
if (ctx->borders[e] & BORDER(de)) {
if (!(ctx->borders[f] & BORDER(df))) {
disconnect(ctx, f, COMPUTE_J, df);
- changed = TRUE;
+ changed = true;
}
} else if (ctx->borders[f] & BORDER(df)) {
disconnect(ctx, e, COMPUTE_J, de);
- changed = TRUE;
+ changed = true;
}
}
@@ -461,7 +461,7 @@
static int solver_equivalent_edges(solver_ctx *ctx)
{
int w = ctx->params->w, h = ctx->params->h, wh = w*h, i, dirj;
- int changed = FALSE;
+ int changed = false;
/* if a square is adjacent to two connected squares, the two
* borders (i,j) and (i,k) are either both on or both off. */
@@ -489,11 +489,11 @@
if (n_on + 2 > ctx->clues[i]) {
connect(ctx, i, j);
connect(ctx, i, k);
- changed = TRUE;
+ changed = true;
} else if (n_off + 2 > 4 - ctx->clues[i]) {
disconnect(ctx, i, j, dirj);
disconnect(ctx, i, k, dirk);
- changed = TRUE;
+ changed = true;
}
}
}
@@ -536,7 +536,7 @@
* - the borders also satisfy the clue set
*/
for (i = 0; i < wh; ++i) {
- if (dsf[i] == UNVISITED) dfs_dsf(i, params->w, border, dsf, TRUE);
+ if (dsf[i] == UNVISITED) dfs_dsf(i, params->w, border, dsf, true);
if (dsf_size(dsf, i) != k) goto error;
if (clues[i] == EMPTY) continue;
if (clues[i] != bitcount[border[i] & BORDER_MASK]) goto error;
@@ -563,11 +563,11 @@
}
sfree(dsf);
- return TRUE;
+ return true;
error:
sfree(dsf);
- return FALSE;
+ return false;
}
static int solver(const game_params *params, clue *clues, borderflag *borders)
@@ -582,7 +582,7 @@
solver_connected_clues_versus_region_size(&ctx); /* idempotent */
do {
- changed = FALSE;
+ changed = false;
changed |= solver_number_exhausted(&ctx);
changed |= solver_not_too_big(&ctx);
changed |= solver_not_too_small(&ctx);
@@ -750,7 +750,7 @@
init_borders(w, h, state->borders);
state->completed = (params->k == wh);
- state->cheated = FALSE;
+ state->cheated = false;
return state;
}
@@ -821,7 +821,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -872,7 +872,7 @@
{
game_ui *ui = snew(game_ui);
ui->x = ui->y = 0;
- ui->show = FALSE;
+ ui->show = false;
return ui;
}
@@ -945,7 +945,7 @@
if (OUT_OF_BOUNDS(hx, hy, w, h)) return NULL;
- ui->show = FALSE;
+ ui->show = false;
i = gy * w + gx;
switch ((button == RIGHT_BUTTON) |
@@ -969,13 +969,13 @@
}
if (IS_CURSOR_MOVE(button)) {
- ui->show = TRUE;
+ ui->show = true;
if (control || shift) {
borderflag flag = 0, newflag;
int dir, i = ui->y * w + ui->x;
x = ui->x;
y = ui->y;
- move_cursor(button, &x, &y, w, h, FALSE);
+ move_cursor(button, &x, &y, w, h, false);
if (OUT_OF_BOUNDS(x, y, w, h)) return NULL;
for (dir = 0; dir < 4; ++dir)
@@ -995,7 +995,7 @@
return string(80, "F%d,%d,%dF%d,%d,%d",
ui->x, ui->y, flag, x, y, newflag);
} else {
- move_cursor(button, &ui->x, &ui->y, w, h, FALSE);
+ move_cursor(button, &ui->x, &ui->y, w, h, false);
return UI_UPDATE;
}
}
@@ -1016,7 +1016,7 @@
ret->borders[i] =
(move[i] & BORDER_MASK) | DISABLED(~move[i] & BORDER_MASK);
if (i < wh || move[i]) return NULL; /* leaks `ret', then we die */
- ret->cheated = ret->completed = TRUE;
+ ret->cheated = ret->completed = true;
return ret;
}
@@ -1190,9 +1190,9 @@
for (i = 0; i < wh; ++i) {
if (black_border_dsf[i] == UNVISITED)
- dfs_dsf(i, w, state->borders, black_border_dsf, TRUE);
+ dfs_dsf(i, w, state->borders, black_border_dsf, true);
if (yellow_border_dsf[i] == UNVISITED)
- dfs_dsf(i, w, state->borders, yellow_border_dsf, FALSE);
+ dfs_dsf(i, w, state->borders, yellow_border_dsf, false);
}
for (r = 0; r < h; ++r)
@@ -1362,7 +1362,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1369,8 +1369,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1387,8 +1387,8 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/pattern.c
+++ b/pattern.c
@@ -87,7 +87,7 @@
char str[80];
if (i < 0 || i >= lenof(pattern_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = pattern_presets[i];
@@ -96,7 +96,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -357,7 +357,7 @@
#define STILL_UNKNOWN 3
#ifdef STANDALONE_SOLVER
-int verbose = FALSE;
+int verbose = false;
#endif
static int do_recurse(unsigned char *known, unsigned char *deduced,
@@ -414,12 +414,12 @@
return lowest >= minpos_ok[ndone] && lowest <= maxpos_ok[ndone];
} else {
for (i=lowest; i<len; i++) {
- if (known[i] == BLOCK) return FALSE;
+ if (known[i] == BLOCK) return false;
row[i] = DOT;
}
for (i=0; i<len; i++)
deduced[i] |= row[i];
- return TRUE;
+ return true;
}
}
@@ -460,12 +460,12 @@
maxpos_ok, data, len, freespace, 0, 0);
}
- done_any = FALSE;
+ done_any = false;
for (i=0; i<len; i++)
if (deduced[i] && deduced[i] != STILL_UNKNOWN && !known[i]) {
start[i*step] = deduced[i];
if (changed) changed[i]++;
- done_any = TRUE;
+ done_any = true;
}
#ifdef STANDALONE_SOLVER
if (verbose && done_any) {
@@ -635,11 +635,11 @@
}
} while (max_h>0 || max_w>0);
- ok = TRUE;
+ ok = true;
for (i=0; i<h; i++) {
for (j=0; j<w; j++) {
if (matrix[i*w+j] == UNKNOWN)
- ok = FALSE;
+ ok = false;
}
}
@@ -677,7 +677,7 @@
* made for rows/columns that are under 3 squares,
* otherwise nothing will ever be successfully generated.
*/
- ok = TRUE;
+ ok = true;
if (w > 2) {
for (i = 0; i < h; i++) {
int colours = 0;
@@ -684,7 +684,7 @@
for (j = 0; j < w; j++)
colours |= (grid[i*w+j] == GRID_FULL ? 2 : 1);
if (colours != 3)
- ok = FALSE;
+ ok = false;
}
}
if (h > 2) {
@@ -693,7 +693,7 @@
for (i = 0; i < h; i++)
colours |= (grid[i*w+j] == GRID_FULL ? 2 : 1);
if (colours != 3)
- ok = FALSE;
+ ok = false;
}
}
if (!ok)
@@ -979,7 +979,7 @@
state->common->rowdata = snewn(state->common->rowsize * (state->common->w + state->common->h), int);
state->common->rowlen = snewn(state->common->w + state->common->h, int);
- state->completed = state->cheated = FALSE;
+ state->completed = state->cheated = false;
for (i = 0; i < params->w + params->h; i++) {
state->common->rowlen[i] = 0;
@@ -1007,7 +1007,7 @@
i += len;
if (len < 25 && i < params->w*params->h) {
state->grid[i] = full ? GRID_FULL : GRID_EMPTY;
- state->common->immutable[i] = TRUE;
+ state->common->immutable[i] = true;
i++;
}
}
@@ -1098,7 +1098,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1118,11 +1118,11 @@
}
}
for (i = 0; i < h; ++i) {
- int rowlen = 0, predecessors = FALSE;
+ int rowlen = 0, predecessors = false;
for (j = 0; j < state->common->rowlen[i+w]; ++j) {
int copy = state->common->rowdata[(i+w)*state->common->rowsize + j];
rowlen += predecessors;
- predecessors = TRUE;
+ predecessors = true;
do ++rowlen; while (copy /= 10);
}
left_gap = max(left_gap, rowlen);
@@ -1203,7 +1203,7 @@
game_ui *ret;
ret = snew(game_ui);
- ret->dragging = FALSE;
+ ret->dragging = false;
ret->cur_x = ret->cur_y = ret->cur_visible = 0;
return ret;
@@ -1253,7 +1253,7 @@
int currstate = state->grid[y * state->common->w + x];
#endif
- ui->dragging = TRUE;
+ ui->dragging = true;
if (button == LEFT_BUTTON) {
ui->drag = LEFT_DRAG;
@@ -1315,7 +1315,7 @@
if (ui->dragging && button == ui->release) {
int x1, x2, y1, y2, xx, yy;
- int move_needed = FALSE;
+ int move_needed = false;
x1 = min(ui->drag_start_x, ui->drag_end_x);
x2 = max(ui->drag_start_x, ui->drag_end_x);
@@ -1326,9 +1326,9 @@
for (xx = x1; xx <= x2; xx++)
if (!state->common->immutable[yy * state->common->w + xx] &&
state->grid[yy * state->common->w + xx] != ui->state)
- move_needed = TRUE;
+ move_needed = true;
- ui->dragging = FALSE;
+ ui->dragging = false;
if (move_needed) {
char buf[80];
@@ -1401,7 +1401,7 @@
for (i = 0; i < ret->common->w * ret->common->h; i++)
ret->grid[i] = (move[i+1] == '1' ? GRID_FULL : GRID_EMPTY);
- ret->completed = ret->cheated = TRUE;
+ ret->completed = ret->cheated = true;
return ret;
} else if ((move[0] == 'F' || move[0] == 'E' || move[0] == 'U') &&
@@ -1428,7 +1428,7 @@
int *rowdata = snewn(ret->common->rowsize, int);
int i, len;
- ret->completed = TRUE;
+ ret->completed = true;
for (i=0; i<ret->common->w; i++) {
len = compute_rowdata(rowdata, ret->grid+i,
@@ -1436,7 +1436,7 @@
if (len != ret->common->rowlen[i] ||
memcmp(ret->common->rowdata+i*ret->common->rowsize,
rowdata, len * sizeof(int))) {
- ret->completed = FALSE;
+ ret->completed = false;
break;
}
}
@@ -1447,7 +1447,7 @@
memcmp(ret->common->rowdata +
(i+ret->common->w)*ret->common->rowsize,
rowdata, len * sizeof(int))) {
- ret->completed = FALSE;
+ ret->completed = false;
break;
}
}
@@ -1556,12 +1556,12 @@
es->rowpos = newpos+1;
es->ncontig++;
- return TRUE;
+ return true;
notfound:;
}
- return FALSE;
+ return false;
#undef ROWDATA
}
@@ -1604,7 +1604,7 @@
} else if (val == GRID_EMPTY) {
if (runlen > 0) {
if (!errcheck_found_run(es, runlen))
- return TRUE; /* error! */
+ return true; /* error! */
}
runlen = 0;
}
@@ -1614,9 +1614,9 @@
* zero run, which will be marked as contiguous with the previous
* run if and only if there hasn't been a GRID_UNKNOWN before. */
if (!errcheck_found_run(es, 0))
- return TRUE; /* error at the last minute! */
+ return true; /* error at the last minute! */
- return FALSE; /* no error */
+ return false; /* no error */
}
/* ----------------------------------------------------------------------
@@ -1669,7 +1669,7 @@
{
struct game_drawstate *ds = snew(struct game_drawstate);
- ds->started = FALSE;
+ ds->started = false;
ds->w = state->common->w;
ds->h = state->common->h;
ds->visible = snewn(ds->w * ds->h, unsigned char);
@@ -1806,7 +1806,7 @@
ds->w * TILE_SIZE + 3, ds->h * TILE_SIZE + 3,
COL_GRID);
- ds->started = TRUE;
+ ds->started = true;
draw_update(dr, 0, 0, SIZE(ds->w), SIZE(ds->h));
}
@@ -1877,7 +1877,7 @@
for (i = 0; i < state->common->w + state->common->h; i++) {
int colour = check_errors(state, i) ? COL_ERROR : COL_TEXT;
if (ds->numcolours[i] != colour) {
- draw_numbers(dr, ds, state, i, TRUE, colour);
+ draw_numbers(dr, ds, state, i, true, colour);
ds->numcolours[i] = colour;
}
}
@@ -1905,7 +1905,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1955,7 +1955,7 @@
* Clues.
*/
for (i = 0; i < state->common->w + state->common->h; i++)
- draw_numbers(dr, ds, state, i, FALSE, ink);
+ draw_numbers(dr, ds, state, i, false, ink);
/*
* Solution.
@@ -1985,7 +1985,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1992,8 +1992,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2010,9 +2010,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON, /* flags */
};
@@ -2029,7 +2029,7 @@
char *p = *++argv;
if (*p == '-') {
if (!strcmp(p, "-v")) {
- verbose = TRUE;
+ verbose = true;
} else {
fprintf(stderr, "%s: unrecognised option `%s'\n", argv[0], p);
return 1;
@@ -2249,8 +2249,8 @@
rs = random_new((void*)&seed, sizeof(time_t));
- desc = new_game_desc(par, rs, NULL, FALSE);
- params = encode_params(par, FALSE);
+ desc = new_game_desc(par, rs, NULL, false);
+ params = encode_params(par, false);
printf("%s:%s\n", params, desc);
sfree(desc);
--- a/pearl.c
+++ b/pearl.c
@@ -150,7 +150,7 @@
game_params *ret = snew(game_params);
*ret = pearl_presets[DEFAULT_PRESET];
- ret->nosolve = FALSE;
+ ret->nosolve = false;
return ret;
}
@@ -160,7 +160,7 @@
game_params *ret;
char buf[64];
- if (i < 0 || i >= lenof(pearl_presets)) return FALSE;
+ if (i < 0 || i >= lenof(pearl_presets)) return false;
ret = default_params();
*ret = pearl_presets[i]; /* struct copy */
@@ -171,7 +171,7 @@
pearl_diffnames[pearl_presets[i].difficulty]);
*name = dupstr(buf);
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -206,9 +206,9 @@
if (*string) string++;
}
- ret->nosolve = FALSE;
+ ret->nosolve = false;
if (*string == 'n') {
- ret->nosolve = TRUE;
+ ret->nosolve = true;
string++;
}
}
@@ -347,7 +347,7 @@
* Now repeatedly try to find something we can do.
*/
while (1) {
- int done_something = FALSE;
+ int done_something = false;
#ifdef SOLVER_DIAGNOSTICS
for (y = 0; y < H; y++) {
@@ -383,7 +383,7 @@
ex/2, ey/2, (ex+1)/2, (ey+1)/2,
b, x, y);
#endif
- done_something = TRUE;
+ done_something = true;
break;
}
}
@@ -437,7 +437,7 @@
if (!(edgeor & d) && workspace[ey*W+ex] == 3) {
workspace[ey*W+ex] = 2;
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
printf("possible states of square (%d,%d) force edge"
" (%d,%d)-(%d,%d) to be disconnected\n",
@@ -445,7 +445,7 @@
#endif
} else if ((edgeand & d) && workspace[ey*W+ex] == 3) {
workspace[ey*W+ex] = 1;
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
printf("possible states of square (%d,%d) force edge"
" (%d,%d)-(%d,%d) to be connected\n",
@@ -483,7 +483,7 @@
*/
if (workspace[fy*W+fx] != (1<<type)) {
workspace[fy*W+fx] = (1<<type);
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
printf("corner clue at (%d,%d) forces square "
"(%d,%d) into state %d\n", x, y,
@@ -501,7 +501,7 @@
*/
if (!(workspace[fy*W+fx] & (1<<type))) {
workspace[ey*W+ex] = 2;
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
printf("corner clue at (%d,%d), plus square "
"(%d,%d) not being state %d, "
@@ -535,7 +535,7 @@
!(workspace[gy*W+gx] & ((1<<( d |A(d))) |
(1<<( d |C(d)))))) {
workspace[(2*y+1)*W+(2*x+1)] &= ~(1<<type);
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
printf("straight clue at (%d,%d) cannot corner at "
"(%d,%d) or (%d,%d) so is not state %d\n",
@@ -561,7 +561,7 @@
if (!(workspace[fy*W+fx] &~ (bLR|bUD)) &&
(workspace[gy*W+gx] &~ (bLU|bLD|bRU|bRD))) {
workspace[gy*W+gx] &= (bLU|bLD|bRU|bRD);
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
printf("straight clue at (%d,%d) connecting to "
"straight at (%d,%d) makes (%d,%d) a "
@@ -743,7 +743,7 @@
* Yes! Mark this edge disconnected.
*/
workspace[y*W+x] = 2;
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
printf("edge (%d,%d)-(%d,%d) would create"
" a shortcut loop, hence must be"
@@ -804,7 +804,7 @@
* state invalid.
*/
workspace[y*W+x] &= ~(1<<b);
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
printf("square (%d,%d) would create a "
"shortcut loop in state %d, "
@@ -1247,7 +1247,7 @@
/*
* See if we can solve the puzzle just like this.
*/
- ret = pearl_solve(w, h, clues, grid, diff, FALSE);
+ ret = pearl_solve(w, h, clues, grid, diff, false);
assert(ret > 0); /* shouldn't be inconsistent! */
if (ret != 1)
continue; /* go round and try again */
@@ -1256,7 +1256,7 @@
* Check this puzzle isn't too easy.
*/
if (diff > DIFF_EASY) {
- ret = pearl_solve(w, h, clues, grid, diff-1, FALSE);
+ ret = pearl_solve(w, h, clues, grid, diff-1, false);
assert(ret > 0);
if (ret == 1)
continue; /* too easy: try again */
@@ -1323,7 +1323,7 @@
clue = clues[y*w+x];
clues[y*w+x] = 0; /* try removing this clue */
- ret = pearl_solve(w, h, clues, grid, diff, FALSE);
+ ret = pearl_solve(w, h, clues, grid, diff, false);
assert(ret > 0);
if (ret != 1)
clues[y*w+x] = clue; /* oops, put it back again */
@@ -1416,7 +1416,7 @@
game_state *state = snew(game_state);
int i, j, sz = params->w*params->h;
- state->completed = state->used_solve = FALSE;
+ state->completed = state->used_solve = false;
state->shared = snew(struct shared_state);
state->shared->w = params->w;
@@ -1511,7 +1511,7 @@
static void check_completion(game_state *state, int mark)
{
int w = state->shared->w, h = state->shared->h, x, y, i, d;
- int had_error = FALSE;
+ int had_error = false;
int *dsf, *component_state;
int nsilly, nloop, npath, largest_comp, largest_size, total_pathsize;
enum { COMP_NONE, COMP_LOOP, COMP_PATH, COMP_SILLY, COMP_EMPTY };
@@ -1522,7 +1522,7 @@
}
}
-#define ERROR(x,y,e) do { had_error = TRUE; if (mark) state->errors[(y)*w+(x)] |= (e); } while(0)
+#define ERROR(x,y,e) do { had_error = true; if (mark) state->errors[(y)*w+(x)] |= (e); } while(0)
/*
* Analyse the solution into loops, paths and stranger things.
@@ -1690,7 +1690,7 @@
* But if not, then we're done!
*/
if (!had_error)
- state->completed = TRUE;
+ state->completed = true;
}
}
@@ -1745,11 +1745,11 @@
* solution from there go back to original state. */
ret = pearl_solve(currstate->shared->w, currstate->shared->h,
currstate->shared->clues, solved->lines,
- DIFFCOUNT, FALSE);
+ DIFFCOUNT, false);
if (ret < 1)
ret = pearl_solve(state->shared->w, state->shared->h,
state->shared->clues, solved->lines,
- DIFFCOUNT, FALSE);
+ DIFFCOUNT, false);
}
@@ -1767,7 +1767,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1808,7 +1808,7 @@
int clickx, clicky; /* pixel position of initial click */
int curx, cury; /* grid position of keyboard cursor */
- int cursor_active; /* TRUE iff cursor is shown */
+ int cursor_active; /* true iff cursor is shown */
};
static game_ui *new_ui(const game_state *state)
@@ -1818,7 +1818,7 @@
ui->ndragcoords = -1;
ui->dragcoords = snewn(sz, int);
- ui->cursor_active = FALSE;
+ ui->cursor_active = false;
ui->curx = ui->cury = 0;
return ui;
@@ -1963,7 +1963,7 @@
*
* Call it in a loop, like this:
*
- * int clearing = TRUE;
+ * int clearing = true;
* for (i = 0; i < ui->ndragcoords - 1; i++) {
* int sx, sy, dx, dy, dir, oldstate, newstate;
* interpret_ui_drag(state, ui, &clearing, i, &sx, &sy, &dx, &dy,
@@ -2003,7 +2003,7 @@
* the drag are set rather than cleared.
*/
*newstate = *dir;
- *clearing = FALSE;
+ *clearing = false;
}
}
@@ -2037,7 +2037,7 @@
{
int w = state->shared->w, h = state->shared->h /*, sz = state->shared->sz */;
int gx = FROMCOORD(x), gy = FROMCOORD(y), i;
- int release = FALSE;
+ int release = false;
char tmpbuf[80];
int shift = button & MOD_SHFT, control = button & MOD_CTRL;
@@ -2044,7 +2044,7 @@
button &= ~MOD_MASK;
if (IS_MOUSE_DOWN(button)) {
- ui->cursor_active = FALSE;
+ ui->cursor_active = false;
if (!INGRID(state, gx, gy)) {
ui->ndragcoords = -1;
@@ -2063,11 +2063,11 @@
return UI_UPDATE;
}
- if (IS_MOUSE_RELEASE(button)) release = TRUE;
+ if (IS_MOUSE_RELEASE(button)) release = true;
if (IS_CURSOR_MOVE(button)) {
if (!ui->cursor_active) {
- ui->cursor_active = TRUE;
+ ui->cursor_active = true;
} else if (control | shift) {
char *move;
if (ui->ndragcoords > 0) return NULL;
@@ -2075,10 +2075,10 @@
move = mark_in_direction(state, ui->curx, ui->cury,
KEY_DIRECTION(button), control, tmpbuf);
if (control && !shift && *move)
- move_cursor(button, &ui->curx, &ui->cury, w, h, FALSE);
+ move_cursor(button, &ui->curx, &ui->cury, w, h, false);
return move;
} else {
- move_cursor(button, &ui->curx, &ui->cury, w, h, FALSE);
+ move_cursor(button, &ui->curx, &ui->cury, w, h, false);
if (ui->ndragcoords >= 0)
update_ui_drag(state, ui, ui->curx, ui->cury);
}
@@ -2087,7 +2087,7 @@
if (IS_CURSOR_SELECT(button)) {
if (!ui->cursor_active) {
- ui->cursor_active = TRUE;
+ ui->cursor_active = true;
return UI_UPDATE;
} else if (button == CURSOR_SELECT) {
if (ui->ndragcoords == -1) {
@@ -2096,7 +2096,7 @@
ui->clickx = CENTERED_COORD(ui->curx);
ui->clicky = CENTERED_COORD(ui->cury);
return UI_UPDATE;
- } else release = TRUE;
+ } else release = true;
} else if (button == CURSOR_SELECT2 && ui->ndragcoords >= 0) {
ui->ndragcoords = -1;
return UI_UPDATE;
@@ -2114,7 +2114,7 @@
int buflen = 0, bufsize = 256, tmplen;
char *buf = NULL;
const char *sep = "";
- int clearing = TRUE;
+ int clearing = true;
for (i = 0; i < ui->ndragcoords - 1; i++) {
int sx, sy, dx, dy, dir, oldstate, newstate;
@@ -2197,7 +2197,7 @@
while (*move) {
c = *move;
if (c == 'S') {
- ret->used_solve = TRUE;
+ ret->used_solve = true;
move++;
} else if (c == 'L' || c == 'N' || c == 'R' || c == 'F' || c == 'M') {
/* 'line' or 'noline' or 'replace' or 'flip' or 'mark' */
@@ -2232,7 +2232,7 @@
move += n;
} else if (strcmp(move, "H") == 0) {
pearl_solve(ret->shared->w, ret->shared->h,
- ret->shared->clues, ret->lines, DIFFCOUNT, TRUE);
+ ret->shared->clues, ret->lines, DIFFCOUNT, true);
for (n = 0; n < w*h; n++)
ret->marks[n] &= ~ret->lines[n]; /* erase marks too */
move++;
@@ -2245,7 +2245,7 @@
goto badmove;
}
- check_completion(ret, TRUE);
+ check_completion(ret, true);
return ret;
@@ -2317,7 +2317,7 @@
int i;
ds->halfsz = 0;
- ds->started = FALSE;
+ ds->started = false;
ds->w = state->shared->w;
ds->h = state->shared->h;
@@ -2477,7 +2477,7 @@
draw_update(dr, 0, 0, w*TILE_SIZE + 2*BORDER, h*TILE_SIZE + 2*BORDER);
- ds->started = TRUE;
+ ds->started = true;
force = 1;
}
@@ -2488,7 +2488,7 @@
memset(ds->draglines, 0, sz);
if (ui->ndragcoords > 0) {
- int i, clearing = TRUE;
+ int i, clearing = true;
for (i = 0; i < ui->ndragcoords - 1; i++) {
int sx, sy, dx, dy, dir, oldstate, newstate;
interpret_ui_drag(state, ui, &clearing, i, &sx, &sy, &dx, &dy,
@@ -2546,7 +2546,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2608,7 +2608,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2615,8 +2615,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2633,9 +2633,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
@@ -2669,7 +2669,7 @@
if (nsecs > 0) printf(" for %d seconds", nsecs);
printf(".\n");
- p->nosolve = TRUE;
+ p->nosolve = true;
grid = snewn(p->w*p->h, char);
clues = snewn(p->w*p->h, char);
@@ -2677,7 +2677,7 @@
while (1) {
n += new_clues(p, rs, clues, grid); /* should be 1, with nosolve */
- ret = pearl_solve(p->w, p->h, clues, grid, DIFF_TRICKY, FALSE);
+ ret = pearl_solve(p->w, p->h, clues, grid, DIFF_TRICKY, false);
if (ret <= 0) nimpossible++;
if (ret == 1) nsolved++;
--- a/pegs.c
+++ b/pegs.c
@@ -83,7 +83,7 @@
char str[80];
if (i < 0 || i >= lenof(pegs_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = pegs_presets[i];
@@ -94,7 +94,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -714,7 +714,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -749,7 +749,7 @@
int x, y, v;
ui->sx = ui->sy = ui->dx = ui->dy = 0;
- ui->dragging = FALSE;
+ ui->dragging = false;
ui->cur_visible = ui->cur_jumping = 0;
/* make sure we start the cursor somewhere on the grid. */
@@ -789,7 +789,7 @@
* Cancel a drag, in case the source square has become
* unoccupied.
*/
- ui->dragging = FALSE;
+ ui->dragging = false;
}
#define PREFERRED_TILE_SIZE 33
@@ -838,7 +838,7 @@
ty = FROMCOORD(y);
if (tx >= 0 && tx < w && ty >= 0 && ty < h &&
state->grid[ty*w+tx] == GRID_PEG) {
- ui->dragging = TRUE;
+ ui->dragging = true;
ui->sx = tx;
ui->sy = ty;
ui->dx = x;
@@ -860,7 +860,7 @@
* Button released. Identify the target square of the drag,
* see if it represents a valid move, and if so make it.
*/
- ui->dragging = FALSE; /* cancel the drag no matter what */
+ ui->dragging = false; /* cancel the drag no matter what */
tx = FROMCOORD(x);
ty = FROMCOORD(y);
if (tx < 0 || tx >= w || ty < 0 || ty >= h)
@@ -1045,7 +1045,7 @@
/* We can't allocate the blitter rectangle for the drag background
* until we know what size to make it. */
ds->drag_background = NULL;
- ds->dragging = FALSE;
+ ds->dragging = false;
ds->w = w;
ds->h = h;
@@ -1052,7 +1052,7 @@
ds->grid = snewn(w*h, unsigned char);
memset(ds->grid, 255, w*h);
- ds->started = FALSE;
+ ds->started = false;
ds->bgcolour = -1;
return ds;
@@ -1120,7 +1120,7 @@
assert(ds->drag_background);
blitter_load(dr, ds->drag_background, ds->dragx, ds->dragy);
draw_update(dr, ds->dragx, ds->dragy, TILESIZE, TILESIZE);
- ds->dragging = FALSE;
+ ds->dragging = false;
}
if (!ds->started) {
@@ -1206,7 +1206,7 @@
TILESIZE, COL_BACKGROUND);
}
- ds->started = TRUE;
+ ds->started = true;
draw_update(dr, 0, 0,
TILESIZE * state->w + 2 * BORDER,
@@ -1244,7 +1244,7 @@
* Draw the dragging sprite if any.
*/
if (ui->dragging) {
- ds->dragging = TRUE;
+ ds->dragging = true;
ds->dragx = ui->dx - TILESIZE/2;
ds->dragy = ui->dy - TILESIZE/2;
blitter_save(dr, ds->drag_background, ds->dragx, ds->dragy);
@@ -1280,7 +1280,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1303,7 +1303,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1310,8 +1310,8 @@
new_game,
dup_game,
free_game,
- FALSE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ false, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1328,9 +1328,9 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/printing.c
+++ b/printing.c
@@ -35,7 +35,7 @@
doc->ph = ph;
doc->puzzles = NULL;
doc->puzzlesize = doc->npuzzles = 0;
- doc->got_solns = FALSE;
+ doc->got_solns = false;
doc->colwid = snewn(pw, float);
doc->rowht = snewn(ph, float);
@@ -85,7 +85,7 @@
doc->puzzles[doc->npuzzles].st2 = st2;
doc->npuzzles++;
if (st2)
- doc->got_solns = TRUE;
+ doc->got_solns = true;
}
static void get_puzzle_size(document *doc, struct puzzle *pz,
--- a/ps.c
+++ b/ps.c
@@ -204,7 +204,7 @@
assert(ps->clipped);
ps_printf(ps, "grestore\n");
- ps->clipped = FALSE;
+ ps->clipped = false;
}
static void ps_clip(void *handle, int x, int y, int w, int h)
@@ -222,7 +222,7 @@
ps_printf(ps, "newpath %g %g moveto %d 0 rlineto 0 %d rlineto"
" %d 0 rlineto closepath\n", x - 0.5, y + 0.5, w, -h, -w);
ps_printf(ps, "clip\n");
- ps->clipped = TRUE;
+ ps->clipped = true;
}
static void ps_line_width(void *handle, float width)
@@ -353,7 +353,7 @@
"%g dup scale\n"
"0 -%d translate\n", xm, xc, ym, yc, wmm/pw, ph);
ps->ytop = ph;
- ps->clipped = FALSE;
+ ps->clipped = false;
ps->gamewidth = pw;
ps->gameheight = ph;
ps->hatchthick = 0.2 * pw / wmm;
@@ -415,7 +415,7 @@
ps->fp = outfile;
ps->colour = colour;
ps->ytop = 0;
- ps->clipped = FALSE;
+ ps->clipped = false;
ps->hatchthick = ps->hatchspace = ps->gamewidth = ps->gameheight = 0;
ps->drawing = drawing_new(&ps_drawing, NULL, ps);
--- a/puzzles.h
+++ b/puzzles.h
@@ -10,13 +10,6 @@
#include <limits.h> /* for UINT_MAX */
#include <stdbool.h>
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
#define PI 3.141592653589793238462643383279502884197169399
#define lenof(array) ( sizeof(array) / sizeof(*(array)) )
--- a/range.c
+++ b/range.c
@@ -127,7 +127,7 @@
{
game_params *ret;
- if (i < 0 || i >= lenof(range_presets)) return FALSE;
+ if (i < 0 || i >= lenof(range_presets)) return false;
ret = default_params();
*ret = range_presets[i]; /* struct copy */
@@ -135,7 +135,7 @@
*name = nfmtstr(40, "%d x %d", range_presets[i].w, range_presets[i].h);
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -388,7 +388,7 @@
{
int const w = state->params.w, h = state->params.h;
int sz = 0;
- while (TRUE) {
+ while (true) {
int cell = idx(r, c, w);
if (out_of_bounds(r, c, w, h)) break;
if (state->grid[cell] > 0) {
@@ -706,7 +706,7 @@
for (i = 0; i < n; ++i) shuffle_1toN[i] = i;
- while (TRUE) {
+ while (true) {
shuffle(shuffle_1toN, n, sizeof (int), rs);
newdesc_choose_black_squares(&state, shuffle_1toN);
@@ -1139,8 +1139,8 @@
}
}
assert(i == n);
- state->has_cheated = FALSE;
- state->was_solved = FALSE;
+ state->has_cheated = false;
+ state->was_solved = false;
return state;
}
@@ -1151,7 +1151,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1228,7 +1228,7 @@
{
struct game_ui *ui = snew(game_ui);
ui->r = ui->c = 0;
- ui->cursor_show = FALSE;
+ ui->cursor_show = false;
return ui;
}
@@ -1282,7 +1282,7 @@
if (out_of_bounds(r, c, w, h)) return NULL;
ui->r = r;
ui->c = c;
- ui->cursor_show = FALSE;
+ ui->cursor_show = false;
}
if (button == LEFT_BUTTON || button == RIGHT_BUTTON) {
@@ -1363,7 +1363,7 @@
ui->r += dr[i];
ui->c += dc[i];
}
- } else ui->cursor_show = TRUE;
+ } else ui->cursor_show = true;
return UI_UPDATE;
}
@@ -1430,7 +1430,7 @@
if (out_of_bounds(rr, cc, w, h)) continue;
if (state->grid[idx(rr, cc, w)] != BLACK) continue;
if (!report) goto found_error;
- report[i] = TRUE;
+ report[i] = true;
break;
}
}
@@ -1445,7 +1445,7 @@
}
if (!report) {
if (runs != state->grid[i]) goto found_error;
- } else if (runs < state->grid[i]) report[i] = TRUE;
+ } else if (runs < state->grid[i]) report[i] = true;
else {
for (runs = 1, j = 0; j < 4; ++j) {
int const rr = r + dr[j], cc = c + dc[j];
@@ -1452,7 +1452,7 @@
runs += runlength(rr, cc, dr[j], dc[j], state,
~(MASK(BLACK) | MASK(EMPTY)));
}
- if (runs > state->grid[i]) report[i] = TRUE;
+ if (runs > state->grid[i]) report[i] = true;
}
}
@@ -1503,16 +1503,16 @@
for (i = 0; i < n; ++i)
if (state->grid[i] != BLACK && dsf_canonify(dsf, i) != canonical)
- report[i] = TRUE;
+ report[i] = true;
}
sfree(dsf);
free_game(dup);
- return FALSE; /* if report != NULL, this is ignored */
+ return false; /* if report != NULL, this is ignored */
found_error:
free_game(dup);
- return TRUE;
+ return true;
}
static game_state *execute_move(const game_state *state, const char *move)
@@ -1527,7 +1527,7 @@
if (*move == 'S') {
++move;
- ret->has_cheated = ret->was_solved = TRUE;
+ ret->has_cheated = ret->was_solved = true;
}
for (; *move; move += nchars) {
@@ -1543,7 +1543,7 @@
ret->grid[idx(r, c, ret->params.w)] = value;
}
- if (ret->was_solved == FALSE)
+ if (ret->was_solved == false)
ret->was_solved = !find_errors(ret, NULL);
return ret;
@@ -1643,11 +1643,11 @@
int i;
ds->tilesize = 0;
- ds->started = FALSE;
+ ds->started = false;
ds->grid = snewn(n, drawcell);
for (i = 0; i < n; ++i)
- ds->grid[i] = makecell(w + h, FALSE, FALSE, FALSE);
+ ds->grid[i] = makecell(w + h, false, false, false);
return ds;
}
@@ -1684,13 +1684,13 @@
int r, c, i;
int *errors = snewn(n, int);
- memset(errors, FALSE, n * sizeof (int));
+ memset(errors, false, n * sizeof (int));
find_errors(state, errors);
assert (oldstate == NULL); /* only happens if animating moves */
if (!ds->started) {
- ds->started = TRUE;
+ ds->started = true;
draw_rect(dr, 0, 0, wpx, hpx, COL_BACKGROUND);
draw_update(dr, 0, 0, wpx, hpx);
}
@@ -1697,9 +1697,9 @@
for (i = r = 0; r < h; ++r) {
for (c = 0; c < w; ++c, ++i) {
- drawcell cell = makecell(state->grid[i], errors[i], FALSE, flash);
+ drawcell cell = makecell(state->grid[i], errors[i], false, flash);
if (r == ui->r && c == ui->c && ui->cursor_show)
- cell.cursor = TRUE;
+ cell.cursor = true;
if (!cell_eq(cell, ds->grid[i])) {
draw_cell(dr, ds, r, c, cell);
ds->grid[i] = cell;
@@ -1748,7 +1748,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
puts("warning: game_timing_state was called (this shouldn't happen)");
- return FALSE; /* the (non-existing) timer should not be running */
+ return false; /* the (non-existing) timer should not be running */
}
/* ----------------------------------------------------------------------
@@ -1780,7 +1780,7 @@
for (i = r = 0; r < h; ++r)
for (c = 0; c < w; ++c, ++i)
draw_cell(dr, ds, r, c,
- makecell(state->grid[i], FALSE, FALSE, FALSE));
+ makecell(state->grid[i], false, false, false));
print_line_width(dr, 3 * tilesize / 40);
draw_rect_outline(dr, BORDER, BORDER, w*TILESIZE, h*TILESIZE, COL_GRID);
@@ -1800,7 +1800,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1807,8 +1807,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1825,8 +1825,8 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/rect.c
+++ b/rect.c
@@ -90,7 +90,7 @@
ret->w = ret->h = 7;
ret->expandfactor = 0.0F;
- ret->unique = TRUE;
+ ret->unique = true;
return ret;
}
@@ -111,7 +111,7 @@
case 5: w = 17, h = 17; break;
case 6: w = 19, h = 19; break;
#endif
- default: return FALSE;
+ default: return false;
}
sprintf(buf, "%dx%d", w, h);
@@ -120,8 +120,8 @@
ret->w = w;
ret->h = h;
ret->expandfactor = 0.0F;
- ret->unique = TRUE;
- return TRUE;
+ ret->unique = true;
+ return true;
}
static void free_params(game_params *params)
@@ -153,7 +153,7 @@
}
if (*string == 'a') {
string++;
- ret->unique = FALSE;
+ ret->unique = false;
}
}
@@ -493,7 +493,7 @@
* Now run the actual deduction loop.
*/
while (1) {
- int done_something = FALSE;
+ int done_something = false;
#ifdef SOLVER_DIAGNOSTICS
printf("starting deduction loop\n");
@@ -606,7 +606,7 @@
for (j = 0; j < rectpositions[i].n; j++) {
int xx, yy, k;
- int del = FALSE;
+ int del = false;
for (k = 0; k < nrects; k++)
workspace[k] = 0;
@@ -632,7 +632,7 @@
rectpositions[i].rects[j].h,
x, y);
#endif
- del = TRUE;
+ del = true;
}
if (rectbyplace[y * w + x] != -1) {
@@ -665,7 +665,7 @@
rectpositions[i].rects[j].h,
k);
#endif
- del = TRUE;
+ del = true;
break;
}
@@ -686,7 +686,7 @@
rectpositions[i].rects[j].w,
rectpositions[i].rects[j].h);
#endif
- del = TRUE;
+ del = true;
}
}
@@ -695,7 +695,7 @@
j--; /* don't skip over next placement */
- done_something = TRUE;
+ done_something = true;
}
}
}
@@ -739,7 +739,7 @@
remove_rect_placement(w, h, rectpositions, overlaps,
index, j);
j--; /* don't skip over next placement */
- done_something = TRUE;
+ done_something = true;
}
}
}
@@ -847,7 +847,7 @@
remove_number_placement(w, h, &numbers[k],
m, rectbyplace);
m--; /* don't skip the next one */
- done_something = TRUE;
+ done_something = true;
}
}
}
@@ -1267,7 +1267,7 @@
int dirs[4], ndirs;
#ifdef GENERATION_DIAGNOSTICS
- display_grid(params2, grid, NULL, FALSE);
+ display_grid(params2, grid, NULL, false);
printf("singleton at %d,%d\n", x, y);
#endif
@@ -1445,7 +1445,7 @@
#ifdef GENERATION_DIAGNOSTICS
printf("before expansion:\n");
- display_grid(params2, grid, NULL, TRUE);
+ display_grid(params2, grid, NULL, true);
#endif
/*
@@ -1573,7 +1573,7 @@
#ifdef GENERATION_DIAGNOSTICS
printf("after expansion:\n");
- display_grid(params3, grid2, NULL, TRUE);
+ display_grid(params3, grid2, NULL, true);
#endif
/*
* Transpose.
@@ -1604,7 +1604,7 @@
#ifdef GENERATION_DIAGNOSTICS
printf("after transposition:\n");
- display_grid(params2, grid, NULL, TRUE);
+ display_grid(params2, grid, NULL, true);
#endif
}
@@ -1731,7 +1731,7 @@
}
#ifdef GENERATION_DIAGNOSTICS
- display_grid(params, grid, numbers, FALSE);
+ display_grid(params, grid, numbers, false);
#endif
desc = snewn(11 * params->w * params->h, char);
@@ -1831,7 +1831,7 @@
* should be if it's there at all. Find out if we
* really have a valid rectangle.
*/
- valid = TRUE;
+ valid = true;
/* Check the horizontal edges. */
for (xx = x; xx < x+rw; xx++) {
for (yy = y; yy <= y+rh; yy++) {
@@ -1838,7 +1838,7 @@
int e = !HRANGE(state,xx,yy) || hedge(state,xx,yy);
int ec = (yy == y || yy == y+rh);
if (e != ec)
- valid = FALSE;
+ valid = false;
}
}
/* Check the vertical edges. */
@@ -1847,7 +1847,7 @@
int e = !VRANGE(state,xx,yy) || vedge(state,xx,yy);
int ec = (xx == x || xx == x+rw);
if (e != ec)
- valid = FALSE;
+ valid = false;
}
}
@@ -1872,13 +1872,13 @@
area++;
if (grid(state,xx,yy)) {
if (num > 0)
- valid = FALSE; /* two numbers */
+ valid = false; /* two numbers */
num = grid(state,xx,yy);
}
}
}
if (num != area)
- valid = FALSE;
+ valid = false;
/*
* Now fill in the whole rectangle based on the
@@ -1908,7 +1908,7 @@
state->grid = snewn(area, int);
state->vedge = snewn(area, unsigned char);
state->hedge = snewn(area, unsigned char);
- state->completed = state->cheated = FALSE;
+ state->completed = state->cheated = false;
i = 0;
while (*desc) {
@@ -2044,7 +2044,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -2192,7 +2192,7 @@
ui->y1 = -1;
ui->x2 = -1;
ui->y2 = -1;
- ui->dragged = FALSE;
+ ui->dragged = false;
}
static game_ui *new_ui(const game_state *state)
@@ -2199,7 +2199,7 @@
{
game_ui *ui = snew(game_ui);
reset_ui(ui);
- ui->erasing = FALSE;
+ ui->erasing = false;
ui->cur_x = ui->cur_y = ui->cur_visible = ui->cur_dragging = 0;
return ui;
}
@@ -2303,7 +2303,7 @@
}
/*
- * Returns TRUE if it has made any change to the grid.
+ * Returns true if it has made any change to the grid.
*/
static int grid_draw_rect(const game_state *state,
unsigned char *hedge, unsigned char *vedge,
@@ -2311,7 +2311,7 @@
int x1, int y1, int x2, int y2)
{
int x, y;
- int changed = FALSE;
+ int changed = false;
/*
* Draw horizontal edges of rectangles.
@@ -2374,7 +2374,7 @@
int x, int y, int button)
{
int xc, yc;
- int startdrag = FALSE, enddrag = FALSE, active = FALSE, erasing = FALSE;
+ int startdrag = false, enddrag = false, active = false, erasing = false;
char buf[80], *ret;
button &= ~MOD_MASK;
@@ -2384,23 +2384,23 @@
if (button == LEFT_BUTTON || button == RIGHT_BUTTON) {
if (ui->drag_start_x >= 0 && ui->cur_dragging)
reset_ui(ui); /* cancel keyboard dragging */
- startdrag = TRUE;
- ui->cur_visible = ui->cur_dragging = FALSE;
- active = TRUE;
+ startdrag = true;
+ ui->cur_visible = ui->cur_dragging = false;
+ active = true;
erasing = (button == RIGHT_BUTTON);
} else if (button == LEFT_RELEASE || button == RIGHT_RELEASE) {
/* We assert we should have had a LEFT_BUTTON first. */
if (ui->cur_visible) {
- ui->cur_visible = FALSE;
- active = TRUE;
+ ui->cur_visible = false;
+ active = true;
}
assert(!ui->cur_dragging);
- enddrag = TRUE;
+ enddrag = true;
erasing = (button == RIGHT_RELEASE);
} else if (IS_CURSOR_MOVE(button)) {
move_cursor(button, &ui->cur_x, &ui->cur_y, from->w, from->h, 0);
- ui->cur_visible = TRUE;
- active = TRUE;
+ ui->cur_visible = true;
+ active = true;
if (!ui->cur_dragging) return UI_UPDATE;
coord_round((float)ui->cur_x + 0.5F, (float)ui->cur_y + 0.5F, &xc, &yc);
} else if (IS_CURSOR_SELECT(button)) {
@@ -2413,27 +2413,27 @@
}
if (!ui->cur_visible) {
assert(!ui->cur_dragging);
- ui->cur_visible = TRUE;
+ ui->cur_visible = true;
return UI_UPDATE;
}
coord_round((float)ui->cur_x + 0.5F, (float)ui->cur_y + 0.5F, &xc, &yc);
erasing = (button == CURSOR_SELECT2);
if (ui->cur_dragging) {
- ui->cur_dragging = FALSE;
- enddrag = TRUE;
- active = TRUE;
+ ui->cur_dragging = false;
+ enddrag = true;
+ active = true;
} else {
- ui->cur_dragging = TRUE;
- startdrag = TRUE;
- active = TRUE;
+ ui->cur_dragging = true;
+ startdrag = true;
+ active = true;
}
} else if (button == '\b' || button == 27) {
if (!ui->cur_dragging) {
- ui->cur_visible = FALSE;
+ ui->cur_visible = false;
} else {
assert(ui->cur_visible);
reset_ui(ui); /* cancel keyboard dragging */
- ui->cur_dragging = FALSE;
+ ui->cur_dragging = false;
}
return UI_UPDATE;
} else if (button != LEFT_DRAG && button != RIGHT_DRAG) {
@@ -2448,9 +2448,9 @@
ui->drag_start_y = yc;
ui->drag_end_x = -1;
ui->drag_end_y = -1;
- ui->dragged = FALSE;
+ ui->dragged = false;
ui->erasing = erasing;
- active = TRUE;
+ active = true;
}
if (ui->drag_start_x >= 0 &&
@@ -2458,10 +2458,10 @@
int t;
if (ui->drag_end_x != -1 && ui->drag_end_y != -1)
- ui->dragged = TRUE;
+ ui->dragged = true;
ui->drag_end_x = xc;
ui->drag_end_y = yc;
- active = TRUE;
+ active = true;
if (xc >= 0 && xc <= 2*from->w &&
yc >= 0 && yc <= 2*from->h) {
@@ -2494,7 +2494,7 @@
if (ui->dragged) {
if (ui_draw_rect(from, ui, from->hedge,
- from->vedge, 1, FALSE, !ui->erasing)) {
+ from->vedge, 1, false, !ui->erasing)) {
sprintf(buf, "%c%d,%d,%d,%d",
(int)(ui->erasing ? 'E' : 'R'),
ui->x1, ui->y1, ui->x2 - ui->x1, ui->y2 - ui->y1);
@@ -2513,7 +2513,7 @@
}
reset_ui(ui);
- active = TRUE;
+ active = true;
}
if (ret)
@@ -2534,7 +2534,7 @@
int x, y;
ret = dup_game(from);
- ret->cheated = TRUE;
+ ret->cheated = true;
for (y = 0; y < ret->h; y++)
for (x = 1; x < ret->w; x++) {
@@ -2570,7 +2570,7 @@
ret = dup_game(from);
if (mode == 'R' || mode == 'E') {
- grid_draw_rect(ret, ret->hedge, ret->vedge, 1, TRUE,
+ grid_draw_rect(ret, ret->hedge, ret->vedge, 1, true,
mode == 'R', x1, y1, x2, y2);
} else if (mode == 'H') {
hedge(ret,x1,y1) = !hedge(ret,x1,y1);
@@ -2588,14 +2588,14 @@
if (!ret->completed) {
int x, y, ok;
- ok = TRUE;
+ ok = true;
for (x = 0; x < ret->w; x++)
for (y = 0; y < ret->h; y++)
if (!index(ret, ret->correct, x, y))
- ok = FALSE;
+ ok = false;
if (ok)
- ret->completed = TRUE;
+ ret->completed = true;
}
return ret;
@@ -2671,7 +2671,7 @@
struct game_drawstate *ds = snew(struct game_drawstate);
int i;
- ds->started = FALSE;
+ ds->started = false;
ds->w = state->w;
ds->h = state->h;
ds->visible = snewn(ds->w * ds->h, unsigned long);
@@ -2758,7 +2758,7 @@
vedge = snewn(state->w*state->h, unsigned char);
memcpy(hedge, state->hedge, state->w*state->h);
memcpy(vedge, state->vedge, state->w*state->h);
- ui_draw_rect(state, ui, hedge, vedge, ui->erasing ? 3 : 2, TRUE, TRUE);
+ ui_draw_rect(state, ui, hedge, vedge, ui->erasing ? 3 : 2, true, true);
} else {
hedge = state->hedge;
vedge = state->vedge;
@@ -2792,7 +2792,7 @@
state->h * TILE_SIZE + 2*BORDER + 1, COL_BACKGROUND);
draw_rect(dr, COORD(0)-1, COORD(0)-1,
ds->w*TILE_SIZE+3, ds->h*TILE_SIZE+3, COL_LINE);
- ds->started = TRUE;
+ ds->started = true;
draw_update(dr, 0, 0,
state->w * TILE_SIZE + 2*BORDER + 1,
state->h * TILE_SIZE + 2*BORDER + 1);
@@ -2881,7 +2881,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2961,7 +2961,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2968,8 +2968,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2986,9 +2986,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/samegame.c
+++ b/samegame.c
@@ -142,20 +142,20 @@
ret->h = 5;
ret->ncols = 3;
ret->scoresub = 2;
- ret->soluble = TRUE;
+ ret->soluble = true;
return ret;
}
static const struct game_params samegame_presets[] = {
- { 5, 5, 3, 2, TRUE },
- { 10, 5, 3, 2, TRUE },
+ { 5, 5, 3, 2, true },
+ { 10, 5, 3, 2, true },
#ifdef SLOW_SYSTEM
- { 10, 10, 3, 2, TRUE },
+ { 10, 10, 3, 2, true },
#else
- { 15, 10, 3, 2, TRUE },
+ { 15, 10, 3, 2, true },
#endif
- { 15, 10, 4, 2, TRUE },
- { 20, 15, 4, 2, TRUE }
+ { 15, 10, 4, 2, true },
+ { 20, 15, 4, 2, true }
};
static bool game_fetch_preset(int i, char **name, game_params **params)
@@ -164,7 +164,7 @@
char str[80];
if (i < 0 || i >= lenof(samegame_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = samegame_presets[i];
@@ -173,7 +173,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -217,7 +217,7 @@
}
if (*p == 'r') {
p++;
- params->soluble = FALSE;
+ params->soluble = false;
}
}
@@ -662,7 +662,7 @@
*/
{
int x1, x2, y1, y2;
- int ok = TRUE;
+ int ok = true;
int fillstart = -1, ntc = 0;
#ifdef GENERATION_DIAGNOSTICS
@@ -691,7 +691,7 @@
#endif
for (x1 = x2 = 0; x2 < w; x2++) {
- int usedcol = FALSE;
+ int usedcol = false;
for (y1 = y2 = h-1; y2 >= 0; y2--) {
if (grid2[y2*w+x2] == tc) {
@@ -706,19 +706,19 @@
printf("adjacency failure at %d,%d\n",
x2, y2);
#endif
- ok = FALSE;
+ ok = false;
}
continue;
}
if (grid2[y2*w+x2] == 0)
break;
- usedcol = TRUE;
+ usedcol = true;
if (grid2[y2*w+x2] != grid[y1*w+x1]) {
#ifdef GENERATION_DIAGNOSTICS
printf("matching failure at %d,%d vs %d,%d\n",
x2, y2, x1, y1);
#endif
- ok = FALSE;
+ ok = false;
}
y1--;
}
@@ -735,7 +735,7 @@
printf("junk at column top (%d,%d)\n",
x1, y1);
#endif
- ok = FALSE;
+ ok = false;
}
y1--;
}
@@ -830,10 +830,10 @@
break;
}
- ok = TRUE;
+ ok = true;
for (i = 0; i < wh; i++)
if (grid[i] == 0) {
- ok = FALSE;
+ ok = false;
failures++;
#if defined GENERATION_DIAGNOSTICS || defined SHOW_INCOMPLETE
{
@@ -1019,7 +1019,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1620,7 +1620,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1643,7 +1643,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1650,8 +1650,8 @@
new_game,
dup_game,
free_game,
- FALSE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ false, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1668,8 +1668,8 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/signpost.c
+++ b/signpost.c
@@ -322,7 +322,7 @@
char buf[80];
if (i < 0 || i >= lenof(signpost_presets))
- return FALSE;
+ return false;
ret = default_params();
*ret = signpost_presets[i];
@@ -332,7 +332,7 @@
ret->force_corner_start ? "" : ", free ends");
*name = dupstr(buf);
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -1442,7 +1442,7 @@
if (!ui->cshow)
ui->cshow = 1;
else if (ui->dragging) {
- ui->dragging = FALSE;
+ ui->dragging = false;
if (ui->sx == ui->cx && ui->sy == ui->cy) return UI_UPDATE;
if (ui->drag_is_from) {
if (!isvalidmove(state, 0, ui->sx, ui->sy, ui->cx, ui->cy))
@@ -1455,7 +1455,7 @@
}
return dupstr(buf);
} else {
- ui->dragging = TRUE;
+ ui->dragging = true;
ui->sx = ui->cx;
ui->sy = ui->cy;
ui->dx = COORD(ui->cx) + TILE_SIZE/2;
@@ -1483,7 +1483,7 @@
return NULL;
}
- ui->dragging = TRUE;
+ ui->dragging = true;
ui->drag_is_from = (button == LEFT_BUTTON) ? 1 : 0;
ui->sx = x;
ui->sy = y;
@@ -1496,7 +1496,7 @@
ui->dy = my;
return UI_UPDATE;
} else if (IS_MOUSE_RELEASE(button) && ui->dragging) {
- ui->dragging = FALSE;
+ ui->dragging = false;
if (ui->sx == x && ui->sy == y) return UI_UPDATE; /* single click */
if (!INGRID(state, x, y)) {
@@ -2042,7 +2042,7 @@
assert(ds->dragb);
blitter_load(dr, ds->dragb, ds->dx, ds->dy);
draw_update(dr, ds->dx, ds->dy, BLITTER_SIZE, BLITTER_SIZE);
- ds->dragging = FALSE;
+ ds->dragging = false;
}
/* If an in-progress drag would make a valid move if finished, we
@@ -2143,7 +2143,7 @@
}
}
if (ui->dragging) {
- ds->dragging = TRUE;
+ ds->dragging = true;
ds->dx = ui->dx - BLITTER_SIZE/2;
ds->dy = ui->dy - BLITTER_SIZE/2;
blitter_save(dr, ds->dragb, ds->dx, ds->dy);
@@ -2151,7 +2151,7 @@
draw_drag_indicator(dr, ds, state, ui, postdrop ? 1 : 0);
}
if (postdrop) free_game(postdrop);
- if (!ds->started) ds->started = TRUE;
+ if (!ds->started) ds->started = true;
}
static float game_anim_length(const game_state *oldstate,
@@ -2177,7 +2177,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2233,7 +2233,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2240,8 +2240,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2258,9 +2258,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON, /* flags */
};
--- a/singles.c
+++ b/singles.c
@@ -153,7 +153,7 @@
char buf[80];
if (i < 0 || i >= lenof(singles_presets))
- return FALSE;
+ return false;
ret = default_params();
*ret = singles_presets[i];
@@ -162,7 +162,7 @@
sprintf(buf, "%dx%d %s", ret->w, ret->h, singles_diffnames[ret->diff]);
*name = dupstr(buf);
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -376,7 +376,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1754,7 +1754,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1815,7 +1815,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1822,8 +1822,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1840,9 +1840,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON, /* flags */
};
--- a/sixteen.c
+++ b/sixteen.c
@@ -74,7 +74,7 @@
case 2: w = 4, h = 4; break;
case 3: w = 5, h = 4; break;
case 4: w = 5, h = 5; break;
- default: return FALSE;
+ default: return false;
}
sprintf(buf, "%dx%d", w, h);
@@ -83,7 +83,7 @@
ret->w = w;
ret->h = h;
ret->movetarget = 0;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -300,7 +300,7 @@
for (i = 0; i < n; i++) {
tiles[i] = -1;
- used[i] = FALSE;
+ used[i] = false;
}
/*
@@ -324,7 +324,7 @@
break;
assert(j < n && !used[j]);
- used[j] = TRUE;
+ used[j] = true;
while (tiles[x] >= 0)
x++;
@@ -408,7 +408,7 @@
used = snewn(area, int);
for (i = 0; i < area; i++)
- used[i] = FALSE;
+ used[i] = false;
for (i = 0; i < area; i++) {
const char *q = p;
@@ -437,7 +437,7 @@
err = "Number used twice";
goto leave;
}
- used[n-1] = TRUE;
+ used[n-1] = true;
if (*p) p++; /* eat comma */
}
@@ -472,7 +472,7 @@
state->completed = state->movecount = 0;
state->movetarget = params->movetarget;
- state->used_solve = FALSE;
+ state->used_solve = false;
state->last_movement_sense = 0;
return state;
@@ -510,7 +510,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -565,7 +565,7 @@
game_ui *ui = snew(game_ui);
ui->cur_x = 0;
ui->cur_y = 0;
- ui->cur_visible = FALSE;
+ ui->cur_visible = false;
ui->cur_mode = unlocked;
return ui;
@@ -620,9 +620,9 @@
if (x < 0 || x >= state->w || y < 0 || y >= state->h)
return NULL;
move_cursor(button | pad, &x, &y,
- state->w, state->h, FALSE);
+ state->w, state->h, false);
move_cursor(button | pad, &xwrap, &ywrap,
- state->w, state->h, TRUE);
+ state->w, state->h, true);
if (x != xwrap) {
sprintf(buf, "R%d,%c1", y, x ? '+' : '-');
@@ -643,7 +643,7 @@
int x = ui->cur_x + 1, y = ui->cur_y + 1;
move_cursor(button | pad, &x, &y,
- state->w + 2, state->h + 2, FALSE);
+ state->w + 2, state->h + 2, false);
if (x == 0 && y == 0) {
int t = ui->cur_x;
@@ -739,7 +739,7 @@
*/
for (i = 0; i < ret->n; i++)
ret->tiles[i] = i+1;
- ret->used_solve = TRUE;
+ ret->used_solve = true;
ret->completed = ret->movecount = 1;
return ret;
@@ -777,7 +777,7 @@
ret->completed = ret->movecount;
for (n = 0; n < ret->n; n++)
if (ret->tiles[n] != n+1)
- ret->completed = FALSE;
+ ret->completed = false;
}
return ret;
@@ -823,7 +823,7 @@
struct game_drawstate *ds = snew(struct game_drawstate);
int i;
- ds->started = FALSE;
+ ds->started = false;
ds->w = state->w;
ds->h = state->h;
ds->bgcolour = COL_BACKGROUND;
@@ -973,7 +973,7 @@
draw_arrow(dr, ds, COORD(0), COORD(i+1), 0, -1, 0);
}
- ds->started = TRUE;
+ ds->started = true;
}
/*
* Cursor (highlighted arrow around edge)
@@ -1152,7 +1152,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1175,7 +1175,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1182,8 +1182,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1200,9 +1200,9 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/slant.c
+++ b/slant.c
@@ -51,9 +51,9 @@
*/
#if defined STANDALONE_SOLVER
#define SOLVER_DIAGNOSTICS
-int verbose = FALSE;
+int verbose = false;
#elif defined SOLVER_DIAGNOSTICS
-#define verbose TRUE
+#define verbose true
#endif
/*
@@ -120,7 +120,7 @@
char str[80];
if (i < 0 || i >= lenof(slant_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = slant_presets[i];
@@ -129,7 +129,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -333,7 +333,7 @@
static void merge_vertices(int *connected,
struct solver_scratch *sc, int i, int j)
{
- int exits = -1, border = FALSE; /* initialise to placate optimiser */
+ int exits = -1, border = false; /* initialise to placate optimiser */
if (sc) {
i = dsf_canonify(connected, i);
@@ -415,12 +415,12 @@
static int vbitmap_clear(int w, int h, struct solver_scratch *sc,
int x, int y, int vbits, const char *reason, ...)
{
- int done_something = FALSE;
+ int done_something = false;
int vbit;
for (vbit = 1; vbit <= 8; vbit <<= 1)
if (vbits & sc->vbitmap[y*w+x] & vbit) {
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
if (verbose) {
va_list ap;
@@ -500,9 +500,9 @@
for (y = 0; y < H; y++)
for (x = 0; x < W; x++) {
if (y == 0 || y == H-1 || x == 0 || x == W-1)
- sc->border[y*W+x] = TRUE;
+ sc->border[y*W+x] = true;
else
- sc->border[y*W+x] = FALSE;
+ sc->border[y*W+x] = false;
if (clues[y*W+x] < 0)
sc->exits[y*W+x] = 4;
@@ -514,7 +514,7 @@
* Repeatedly try to deduce something until we can't.
*/
do {
- done_something = FALSE;
+ done_something = false;
/*
* Any clue point with the number of remaining lines equal
@@ -645,7 +645,7 @@
sc->connected, sc);
}
- done_something = TRUE;
+ done_something = true;
} else if (nu == 2 && nl == 1 && difficulty > DIFF_EASY) {
/*
* If we have precisely two undecided squares
@@ -740,8 +740,8 @@
if (soln[y*w+x])
continue; /* got this one already */
- fs = FALSE;
- bs = FALSE;
+ fs = false;
+ bs = false;
if (difficulty > DIFF_EASY)
v = sc->slashval[dsf_canonify(sc->equiv, y*w+x)];
@@ -756,7 +756,7 @@
c1 = dsf_canonify(sc->connected, y*W+x);
c2 = dsf_canonify(sc->connected, (y+1)*W+(x+1));
if (c1 == c2) {
- fs = TRUE;
+ fs = true;
#ifdef SOLVER_DIAGNOSTICS
reason = "simple loop avoidance";
#endif
@@ -764,13 +764,13 @@
if (difficulty > DIFF_EASY &&
!sc->border[c1] && !sc->border[c2] &&
sc->exits[c1] <= 1 && sc->exits[c2] <= 1) {
- fs = TRUE;
+ fs = true;
#ifdef SOLVER_DIAGNOSTICS
reason = "dead end avoidance";
#endif
}
if (v == +1) {
- fs = TRUE;
+ fs = true;
#ifdef SOLVER_DIAGNOSTICS
reason = "equivalence to an already filled square";
#endif
@@ -783,7 +783,7 @@
c1 = dsf_canonify(sc->connected, y*W+(x+1));
c2 = dsf_canonify(sc->connected, (y+1)*W+x);
if (c1 == c2) {
- bs = TRUE;
+ bs = true;
#ifdef SOLVER_DIAGNOSTICS
reason = "simple loop avoidance";
#endif
@@ -791,13 +791,13 @@
if (difficulty > DIFF_EASY &&
!sc->border[c1] && !sc->border[c2] &&
sc->exits[c1] <= 1 && sc->exits[c2] <= 1) {
- bs = TRUE;
+ bs = true;
#ifdef SOLVER_DIAGNOSTICS
reason = "dead end avoidance";
#endif
}
if (v == -1) {
- bs = TRUE;
+ bs = true;
#ifdef SOLVER_DIAGNOSTICS
reason = "equivalence to an already filled square";
#endif
@@ -820,7 +820,7 @@
printf("employing %s\n", reason);
#endif
fill_square(w, h, x, y, +1, soln, sc->connected, sc);
- done_something = TRUE;
+ done_something = true;
} else if (bs) {
#ifdef SOLVER_DIAGNOSTICS
if (verbose)
@@ -827,7 +827,7 @@
printf("employing %s\n", reason);
#endif
fill_square(w, h, x, y, -1, soln, sc->connected, sc);
- done_something = TRUE;
+ done_something = true;
}
}
@@ -877,7 +877,7 @@
if (dsf_canonify(sc->equiv, n1) !=
dsf_canonify(sc->equiv, n2)) {
dsf_merge(sc->equiv, n1, n2);
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
if (verbose)
printf("(%d,%d) and (%d,%d) must be equivalent"
@@ -891,7 +891,7 @@
if (dsf_canonify(sc->equiv, n1) !=
dsf_canonify(sc->equiv, n2)) {
dsf_merge(sc->equiv, n1, n2);
- done_something = TRUE;
+ done_something = true;
#ifdef SOLVER_DIAGNOSTICS
if (verbose)
printf("(%d,%d) and (%d,%d) must be equivalent"
@@ -1248,7 +1248,7 @@
state->p = *params;
state->soln = snewn(w*h, signed char);
memset(state->soln, 0, w*h);
- state->completed = state->used_solve = FALSE;
+ state->completed = state->used_solve = false;
state->errors = snewn(W*H, unsigned char);
memset(state->errors, 0, W*H);
@@ -1379,7 +1379,7 @@
static int check_completion(game_state *state)
{
int w = state->p.w, h = state->p.h, W = w+1, H = h+1;
- int x, y, err = FALSE;
+ int x, y, err = false;
memset(state->errors, 0, W*H);
@@ -1392,7 +1392,7 @@
ctx.state = state;
if (findloop_run(fls, W*H, slant_neighbour, &ctx))
- err = TRUE;
+ err = true;
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
int u, v;
@@ -1430,11 +1430,11 @@
* grounds for marking the vertex as erroneous.
*/
if (vertex_degree(w, h, state->soln, x, y,
- FALSE, NULL, NULL) > c ||
+ false, NULL, NULL) > c ||
vertex_degree(w, h, state->soln, x, y,
- TRUE, NULL, NULL) > 4-c) {
+ true, NULL, NULL) > 4-c) {
state->errors[y*W+x] |= ERR_VERTEX;
- err = TRUE;
+ err = true;
}
}
@@ -1445,14 +1445,14 @@
*/
if (err)
- return FALSE;
+ return false;
for (y = 0; y < h; y++)
for (x = 0; x < w; x++)
if (state->soln[y*w+x] == 0)
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
static char *solve_game(const game_state *state, const game_state *currstate,
@@ -1461,7 +1461,7 @@
int w = state->p.w, h = state->p.h;
signed char *soln;
int bs, ret;
- int free_soln = FALSE;
+ int free_soln = false;
char *move, buf[80];
int movelen, movesize;
int x, y;
@@ -1473,7 +1473,7 @@
*/
soln = (signed char *)aux;
bs = (signed char)'\\';
- free_soln = FALSE;
+ free_soln = false;
} else {
struct solver_scratch *sc = new_scratch(w, h);
soln = snewn(w*h, signed char);
@@ -1488,7 +1488,7 @@
*error = "Unable to find a unique solution for this puzzle";
return NULL;
}
- free_soln = TRUE;
+ free_soln = true;
}
/*
@@ -1522,7 +1522,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1730,7 +1730,7 @@
while (*move) {
c = *move;
if (c == 'S') {
- ret->used_solve = TRUE;
+ ret->used_solve = true;
move++;
} else if (c == '\\' || c == '/' || c == 'C') {
move++;
@@ -1826,7 +1826,7 @@
struct game_drawstate *ds = snew(struct game_drawstate);
ds->tilesize = 0;
- ds->started = FALSE;
+ ds->started = false;
ds->grid = snewn((w+2)*(h+2), long);
ds->todraw = snewn((w+2)*(h+2), long);
for (i = 0; i < (w+2)*(h+2); i++)
@@ -1964,7 +1964,7 @@
if (flashtime > 0)
flashing = (int)(flashtime * 3 / FLASH_TIME) != 1;
else
- flashing = FALSE;
+ flashing = false;
if (!ds->started) {
int ww, wh;
@@ -1971,7 +1971,7 @@
game_compute_size(&state->p, TILESIZE, &ww, &wh);
draw_rect(dr, 0, 0, ww, wh, COL_BACKGROUND);
draw_update(dr, 0, 0, ww, wh);
- ds->started = TRUE;
+ ds->started = true;
}
/*
@@ -2065,7 +2065,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2136,7 +2136,7 @@
for (y = 0; y <= h; y++)
for (x = 0; x <= w; x++)
draw_clue(dr, ds, x, y, state->clues->clues[y*W+x],
- FALSE, paper, ink);
+ false, paper, ink);
}
#ifdef COMBINED
@@ -2151,7 +2151,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2158,8 +2158,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2176,9 +2176,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
@@ -2192,16 +2192,16 @@
game_state *s;
char *id = NULL, *desc;
const char *err;
- int grade = FALSE;
- int ret, diff, really_verbose = FALSE;
+ int grade = false;
+ int ret, diff, really_verbose = false;
struct solver_scratch *sc;
while (--argc > 0) {
char *p = *++argv;
if (!strcmp(p, "-v")) {
- really_verbose = TRUE;
+ really_verbose = true;
} else if (!strcmp(p, "-g")) {
- grade = TRUE;
+ grade = true;
} else if (*p == '-') {
fprintf(stderr, "%s: unrecognised option `%s'\n", argv[0], p);
return 1;
--- a/solo.c
+++ b/solo.c
@@ -275,8 +275,8 @@
game_params *ret = snew(game_params);
ret->c = ret->r = 3;
- ret->xtype = FALSE;
- ret->killer = FALSE;
+ ret->xtype = false;
+ ret->killer = false;
ret->symm = SYMM_ROT2; /* a plausible default */
ret->diff = DIFF_BLOCK; /* so is this */
ret->kdiff = DIFF_KINTERSECT; /* so is this */
@@ -302,47 +302,47 @@
const char *title;
game_params params;
} const presets[] = {
- { "2x2 Trivial", { 2, 2, SYMM_ROT2, DIFF_BLOCK, DIFF_KMINMAX, FALSE, FALSE } },
- { "2x3 Basic", { 2, 3, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, FALSE, FALSE } },
- { "3x3 Trivial", { 3, 3, SYMM_ROT2, DIFF_BLOCK, DIFF_KMINMAX, FALSE, FALSE } },
- { "3x3 Basic", { 3, 3, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, FALSE, FALSE } },
- { "3x3 Basic X", { 3, 3, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, TRUE } },
- { "3x3 Intermediate", { 3, 3, SYMM_ROT2, DIFF_INTERSECT, DIFF_KMINMAX, FALSE, FALSE } },
- { "3x3 Advanced", { 3, 3, SYMM_ROT2, DIFF_SET, DIFF_KMINMAX, FALSE, FALSE } },
- { "3x3 Advanced X", { 3, 3, SYMM_ROT2, DIFF_SET, DIFF_KMINMAX, TRUE } },
- { "3x3 Extreme", { 3, 3, SYMM_ROT2, DIFF_EXTREME, DIFF_KMINMAX, FALSE, FALSE } },
- { "3x3 Unreasonable", { 3, 3, SYMM_ROT2, DIFF_RECURSIVE, DIFF_KMINMAX, FALSE, FALSE } },
- { "3x3 Killer", { 3, 3, SYMM_NONE, DIFF_BLOCK, DIFF_KINTERSECT, FALSE, TRUE } },
- { "9 Jigsaw Basic", { 9, 1, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, FALSE, FALSE } },
- { "9 Jigsaw Basic X", { 9, 1, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, TRUE } },
- { "9 Jigsaw Advanced", { 9, 1, SYMM_ROT2, DIFF_SET, DIFF_KMINMAX, FALSE, FALSE } },
+ { "2x2 Trivial", { 2, 2, SYMM_ROT2, DIFF_BLOCK, DIFF_KMINMAX, false, false } },
+ { "2x3 Basic", { 2, 3, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, false, false } },
+ { "3x3 Trivial", { 3, 3, SYMM_ROT2, DIFF_BLOCK, DIFF_KMINMAX, false, false } },
+ { "3x3 Basic", { 3, 3, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, false, false } },
+ { "3x3 Basic X", { 3, 3, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, true } },
+ { "3x3 Intermediate", { 3, 3, SYMM_ROT2, DIFF_INTERSECT, DIFF_KMINMAX, false, false } },
+ { "3x3 Advanced", { 3, 3, SYMM_ROT2, DIFF_SET, DIFF_KMINMAX, false, false } },
+ { "3x3 Advanced X", { 3, 3, SYMM_ROT2, DIFF_SET, DIFF_KMINMAX, true } },
+ { "3x3 Extreme", { 3, 3, SYMM_ROT2, DIFF_EXTREME, DIFF_KMINMAX, false, false } },
+ { "3x3 Unreasonable", { 3, 3, SYMM_ROT2, DIFF_RECURSIVE, DIFF_KMINMAX, false, false } },
+ { "3x3 Killer", { 3, 3, SYMM_NONE, DIFF_BLOCK, DIFF_KINTERSECT, false, true } },
+ { "9 Jigsaw Basic", { 9, 1, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, false, false } },
+ { "9 Jigsaw Basic X", { 9, 1, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, true } },
+ { "9 Jigsaw Advanced", { 9, 1, SYMM_ROT2, DIFF_SET, DIFF_KMINMAX, false, false } },
#ifndef SLOW_SYSTEM
- { "3x4 Basic", { 3, 4, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, FALSE, FALSE } },
- { "4x4 Basic", { 4, 4, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, FALSE, FALSE } },
+ { "3x4 Basic", { 3, 4, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, false, false } },
+ { "4x4 Basic", { 4, 4, SYMM_ROT2, DIFF_SIMPLE, DIFF_KMINMAX, false, false } },
#endif
};
if (i < 0 || i >= lenof(presets))
- return FALSE;
+ return false;
*name = dupstr(presets[i].title);
*params = dup_params(&presets[i].params);
- return TRUE;
+ return true;
}
static void decode_params(game_params *ret, char const *string)
{
- int seen_r = FALSE;
+ int seen_r = false;
ret->c = ret->r = atoi(string);
- ret->xtype = FALSE;
- ret->killer = FALSE;
+ ret->xtype = false;
+ ret->killer = false;
while (*string && isdigit((unsigned char)*string)) string++;
if (*string == 'x') {
string++;
ret->r = atoi(string);
- seen_r = TRUE;
+ seen_r = true;
while (*string && isdigit((unsigned char)*string)) string++;
}
while (*string) {
@@ -353,18 +353,18 @@
ret->r = 1;
} else if (*string == 'x') {
string++;
- ret->xtype = TRUE;
+ ret->xtype = true;
} else if (*string == 'k') {
string++;
- ret->killer = TRUE;
+ ret->killer = true;
} else if (*string == 'r' || *string == 'm' || *string == 'a') {
int sn, sc, sd;
sc = *string++;
if (sc == 'm' && *string == 'd') {
- sd = TRUE;
+ sd = true;
string++;
} else {
- sd = FALSE;
+ sd = false;
}
sn = atoi(string);
while (*string && isdigit((unsigned char)*string)) string++;
@@ -708,7 +708,7 @@
struct block_structure *blocks, *kblocks, *extra_cages;
/*
* We set up a cubic array, indexed by x, y and digit; each
- * element of this array is TRUE or FALSE according to whether
+ * element of this array is true or false according to whether
* or not that digit _could_ in principle go in that position.
*
* The way to index this array is cube[(y*cr+x)*cr+n-1]; there
@@ -730,13 +730,13 @@
* have yet to work out, to prevent doing the same deduction
* many times.
*/
- /* row[y*cr+n-1] TRUE if digit n has been placed in row y */
+ /* row[y*cr+n-1] true if digit n has been placed in row y */
unsigned char *row;
- /* col[x*cr+n-1] TRUE if digit n has been placed in row x */
+ /* col[x*cr+n-1] true if digit n has been placed in row x */
unsigned char *col;
- /* blk[i*cr+n-1] TRUE if digit n has been placed in block i */
+ /* blk[i*cr+n-1] true if digit n has been placed in block i */
unsigned char *blk;
- /* diag[i*cr+n-1] TRUE if digit n has been placed in diagonal i */
+ /* diag[i*cr+n-1] true if digit n has been placed in diagonal i */
unsigned char *diag; /* diag 0 is \, 1 is / */
int *regions;
@@ -771,7 +771,7 @@
*/
for (i = 1; i <= cr; i++)
if (i != n)
- cube(x,y,i) = FALSE;
+ cube(x,y,i) = false;
/*
* Rule out this number in all other positions in the row.
@@ -778,7 +778,7 @@
*/
for (i = 0; i < cr; i++)
if (i != y)
- cube(x,i,n) = FALSE;
+ cube(x,i,n) = false;
/*
* Rule out this number in all other positions in the column.
@@ -785,7 +785,7 @@
*/
for (i = 0; i < cr; i++)
if (i != x)
- cube(i,y,n) = FALSE;
+ cube(i,y,n) = false;
/*
* Rule out this number in all other positions in the block.
@@ -794,7 +794,7 @@
for (i = 0; i < cr; i++) {
int bp = usage->blocks->blocks[bi][i];
if (bp != sqindex)
- cube2(bp,n) = FALSE;
+ cube2(bp,n) = false;
}
/*
@@ -807,20 +807,20 @@
* in its row, its column and its block.
*/
usage->row[y*cr+n-1] = usage->col[x*cr+n-1] =
- usage->blk[bi*cr+n-1] = TRUE;
+ usage->blk[bi*cr+n-1] = true;
if (usage->diag) {
if (ondiag0(sqindex)) {
for (i = 0; i < cr; i++)
if (diag0(i) != sqindex)
- cube2(diag0(i),n) = FALSE;
- usage->diag[n-1] = TRUE;
+ cube2(diag0(i),n) = false;
+ usage->diag[n-1] = true;
}
if (ondiag1(sqindex)) {
for (i = 0; i < cr; i++)
if (diag1(i) != sqindex)
- cube2(diag1(i),n) = FALSE;
- usage->diag[cr+n-1] = TRUE;
+ cube2(diag1(i),n) = false;
+ usage->diag[cr+n-1] = true;
}
}
}
@@ -1005,8 +1005,8 @@
* any row with a solitary 1 - and discarding that row and the
* column containing the 1.
*/
- memset(rowidx, TRUE, cr);
- memset(colidx, TRUE, cr);
+ memset(rowidx, true, cr);
+ memset(colidx, true, cr);
for (i = 0; i < cr; i++) {
int count = 0, first = -1;
for (j = 0; j < cr; j++)
@@ -1033,7 +1033,7 @@
return -1;
}
if (count == 1)
- rowidx[i] = colidx[first] = FALSE;
+ rowidx[i] = colidx[first] = false;
}
/*
@@ -1079,10 +1079,10 @@
*/
int rows = 0;
for (i = 0; i < n; i++) {
- int ok = TRUE;
+ int ok = true;
for (j = 0; j < n; j++)
if (set[j] && grid[i*cr+j]) {
- ok = FALSE;
+ ok = false;
break;
}
if (ok)
@@ -1114,7 +1114,7 @@
}
if (rows >= n - count) {
- int progress = FALSE;
+ int progress = false;
/*
* We've got one! Now, for each row which _doesn't_
@@ -1128,10 +1128,10 @@
* positions in the cube to meddle with.
*/
for (i = 0; i < n; i++) {
- int ok = TRUE;
+ int ok = true;
for (j = 0; j < n; j++)
if (set[j] && grid[i*cr+j]) {
- ok = FALSE;
+ ok = false;
break;
}
if (!ok) {
@@ -1162,8 +1162,8 @@
pn, 1+px, 1+py);
}
#endif
- progress = TRUE;
- usage->cube[fpos] = FALSE;
+ progress = true;
+ usage->cube[fpos] = false;
}
}
}
@@ -1386,7 +1386,7 @@
orign, 1+xt, 1+yt);
}
#endif
- cube(xt, yt, orign) = FALSE;
+ cube(xt, yt, orign) = false;
return 1;
}
}
@@ -1437,7 +1437,7 @@
}
}
if (maxval + n < clues[b]) {
- cube2(x, n) = FALSE;
+ cube2(x, n) = false;
ret = 1;
#ifdef STANDALONE_SOLVER
if (solver_show_working)
@@ -1447,7 +1447,7 @@
#endif
}
if (minval + n > clues[b]) {
- cube2(x, n) = FALSE;
+ cube2(x, n) = false;
ret = 1;
#ifdef STANDALONE_SOLVER
if (solver_show_working)
@@ -1580,7 +1580,7 @@
if (!cube2(x, n))
continue;
if ((possible_addends & (1 << n)) == 0) {
- cube2(x, n) = FALSE;
+ cube2(x, n) = false;
ret = 1;
#ifdef STANDALONE_SOLVER
if (solver_show_working) {
@@ -1748,18 +1748,18 @@
usage->kclues = NULL;
}
- memset(usage->cube, TRUE, cr*cr*cr);
+ memset(usage->cube, true, cr*cr*cr);
usage->row = snewn(cr * cr, unsigned char);
usage->col = snewn(cr * cr, unsigned char);
usage->blk = snewn(cr * cr, unsigned char);
- memset(usage->row, FALSE, cr * cr);
- memset(usage->col, FALSE, cr * cr);
- memset(usage->blk, FALSE, cr * cr);
+ memset(usage->row, false, cr * cr);
+ memset(usage->col, false, cr * cr);
+ memset(usage->blk, false, cr * cr);
if (xtype) {
usage->diag = snewn(cr * 2, unsigned char);
- memset(usage->diag, FALSE, cr * 2);
+ memset(usage->diag, false, cr * 2);
} else
usage->diag = NULL;
@@ -1840,7 +1840,7 @@
}
if (usage->kclues != NULL) {
- int changed = FALSE;
+ int changed = false;
/*
* First, bring the kblocks into a more useful form: remove
@@ -1866,7 +1866,7 @@
* about the other squares in the cage.
*/
for (n = 0; n < usage->kblocks->nr_squares[b]; n++) {
- cube2(usage->kblocks->blocks[b][n], t) = FALSE;
+ cube2(usage->kblocks->blocks[b][n], t) = false;
}
}
@@ -1897,7 +1897,7 @@
v, 1 + x%cr, 1 + x/cr);
}
#endif
- changed = TRUE;
+ changed = true;
}
}
@@ -1907,7 +1907,7 @@
}
}
if (dlev->maxkdiff >= DIFF_KINTERSECT && usage->kclues != NULL) {
- int changed = FALSE;
+ int changed = false;
/*
* Now, create the extra_cages information. Every full region
* (row, column, or block) has the same sum total (45 for 3x3
@@ -1952,7 +1952,7 @@
goto got_result;
}
solver_place(usage, x, y, sum);
- changed = TRUE;
+ changed = true;
#ifdef STANDALONE_SOLVER
if (solver_show_working) {
printf("%*s placing %d at (%d,%d)\n",
@@ -1996,7 +1996,7 @@
* implement it for a higher difficulty level.
*/
if (dlev->maxkdiff >= DIFF_KMINMAX && usage->kclues != NULL) {
- int changed = FALSE;
+ int changed = false;
for (b = 0; b < usage->kblocks->nr_blocks; b++) {
int ret = solver_killer_minmax(usage, usage->kblocks,
usage->kclues, b
@@ -2008,7 +2008,7 @@
diff = DIFF_IMPOSSIBLE;
goto got_result;
} else if (ret > 0)
- changed = TRUE;
+ changed = true;
}
for (b = 0; b < usage->extra_cages->nr_blocks; b++) {
int ret = solver_killer_minmax(usage, usage->extra_cages,
@@ -2021,7 +2021,7 @@
diff = DIFF_IMPOSSIBLE;
goto got_result;
} else if (ret > 0)
- changed = TRUE;
+ changed = true;
}
if (changed) {
kdiff = max(kdiff, DIFF_KMINMAX);
@@ -2035,17 +2035,17 @@
* This can only be used if a cage lies entirely within a region.
*/
if (dlev->maxkdiff >= DIFF_KSUMS && usage->kclues != NULL) {
- int changed = FALSE;
+ int changed = false;
for (b = 0; b < usage->kblocks->nr_blocks; b++) {
int ret = solver_killer_sums(usage, b, usage->kblocks,
- usage->kclues[b], TRUE
+ usage->kclues[b], true
#ifdef STANDALONE_SOLVER
, "regular clues"
#endif
);
if (ret > 0) {
- changed = TRUE;
+ changed = true;
kdiff = max(kdiff, DIFF_KSUMS);
} else if (ret < 0) {
diff = DIFF_IMPOSSIBLE;
@@ -2055,13 +2055,13 @@
for (b = 0; b < usage->extra_cages->nr_blocks; b++) {
int ret = solver_killer_sums(usage, b, usage->extra_cages,
- usage->extra_clues[b], FALSE
+ usage->extra_clues[b], false
#ifdef STANDALONE_SOLVER
, "deduced clues"
#endif
);
if (ret > 0) {
- changed = TRUE;
+ changed = true;
kdiff = max(kdiff, DIFF_KSUMS);
} else if (ret < 0) {
diff = DIFF_IMPOSSIBLE;
@@ -2766,13 +2766,13 @@
* in the grid, we have a solution.
*/
if (usage->nspaces == 0)
- return TRUE;
+ return true;
/*
* Next, abandon generation if we went over our steps limit.
*/
if (*steps <= 0)
- return FALSE;
+ return false;
(*steps)--;
/*
@@ -2850,7 +2850,7 @@
shuffle(digits, j, sizeof(*digits), usage->rs);
/* And finally, go through the digit list and actually recurse. */
- ret = FALSE;
+ ret = false;
for (i = 0; i < j; i++) {
n = digits[i];
@@ -2860,7 +2860,7 @@
/* Call the solver recursively. Stop when we find a solution. */
if (gridgen_real(usage, grid, steps)) {
- ret = TRUE;
+ ret = true;
break;
}
@@ -2905,7 +2905,7 @@
if (kblocks != NULL) {
usage->kblocks = kblocks;
usage->cge = snewn(usage->kblocks->nr_blocks, unsigned int);
- memset(usage->cge, FALSE, kblocks->nr_blocks * sizeof *usage->cge);
+ memset(usage->cge, false, kblocks->nr_blocks * sizeof *usage->cge);
} else {
usage->cge = NULL;
}
@@ -3024,14 +3024,14 @@
* Check that each row contains precisely one of everything.
*/
for (y = 0; y < cr; y++) {
- memset(used, FALSE, cr);
+ memset(used, false, cr);
for (x = 0; x < cr; x++)
if (grid[y*cr+x] > 0 && grid[y*cr+x] <= cr)
- used[grid[y*cr+x]-1] = TRUE;
+ used[grid[y*cr+x]-1] = true;
for (n = 0; n < cr; n++)
if (!used[n]) {
sfree(used);
- return FALSE;
+ return false;
}
}
@@ -3039,14 +3039,14 @@
* Check that each column contains precisely one of everything.
*/
for (x = 0; x < cr; x++) {
- memset(used, FALSE, cr);
+ memset(used, false, cr);
for (y = 0; y < cr; y++)
if (grid[y*cr+x] > 0 && grid[y*cr+x] <= cr)
- used[grid[y*cr+x]-1] = TRUE;
+ used[grid[y*cr+x]-1] = true;
for (n = 0; n < cr; n++)
if (!used[n]) {
sfree(used);
- return FALSE;
+ return false;
}
}
@@ -3054,15 +3054,15 @@
* Check that each block contains precisely one of everything.
*/
for (i = 0; i < cr; i++) {
- memset(used, FALSE, cr);
+ memset(used, false, cr);
for (j = 0; j < cr; j++)
if (grid[blocks->blocks[i][j]] > 0 &&
grid[blocks->blocks[i][j]] <= cr)
- used[grid[blocks->blocks[i][j]]-1] = TRUE;
+ used[grid[blocks->blocks[i][j]]-1] = true;
for (n = 0; n < cr; n++)
if (!used[n]) {
sfree(used);
- return FALSE;
+ return false;
}
}
@@ -3074,20 +3074,20 @@
*/
if (kblocks) {
for (i = 0; i < kblocks->nr_blocks; i++) {
- memset(used, FALSE, cr);
+ memset(used, false, cr);
for (j = 0; j < kblocks->nr_squares[i]; j++)
if (grid[kblocks->blocks[i][j]] > 0 &&
grid[kblocks->blocks[i][j]] <= cr) {
if (used[grid[kblocks->blocks[i][j]]-1]) {
sfree(used);
- return FALSE;
+ return false;
}
- used[grid[kblocks->blocks[i][j]]-1] = TRUE;
+ used[grid[kblocks->blocks[i][j]]-1] = true;
}
if (kgrid && check_killer_cage_sum(kblocks, kgrid, grid, i) != 1) {
sfree(used);
- return FALSE;
+ return false;
}
}
}
@@ -3096,29 +3096,29 @@
* Check that each diagonal contains precisely one of everything.
*/
if (xtype) {
- memset(used, FALSE, cr);
+ memset(used, false, cr);
for (i = 0; i < cr; i++)
if (grid[diag0(i)] > 0 && grid[diag0(i)] <= cr)
- used[grid[diag0(i)]-1] = TRUE;
+ used[grid[diag0(i)]-1] = true;
for (n = 0; n < cr; n++)
if (!used[n]) {
sfree(used);
- return FALSE;
+ return false;
}
- memset(used, FALSE, cr);
+ memset(used, false, cr);
for (i = 0; i < cr; i++)
if (grid[diag1(i)] > 0 && grid[diag1(i)] <= cr)
- used[grid[diag1(i)]-1] = TRUE;
+ used[grid[diag1(i)]-1] = true;
for (n = 0; n < cr; n++)
if (!used[n]) {
sfree(used);
- return FALSE;
+ return false;
}
}
sfree(used);
- return TRUE;
+ return true;
}
static int symmetries(const game_params *params, int x, int y,
@@ -3276,7 +3276,7 @@
int x, y, p0, p1, edge;
if (i == 2*cr*(cr-1)) {
- edge = TRUE; /* terminating virtual edge */
+ edge = true; /* terminating virtual edge */
} else {
if (i < cr*(cr-1)) {
y = i/(cr-1);
@@ -3510,11 +3510,11 @@
*/
merge_blocks(b, n1, n2);
sfree(pairs);
- return TRUE;
+ return true;
}
sfree(pairs);
- return FALSE;
+ return false;
}
static void compute_kclues(struct block_structure *cages, digit *kclues,
@@ -4135,7 +4135,7 @@
state->pencil = snewn(area * cr, unsigned char);
memset(state->pencil, 0, area * cr);
state->immutable = snewn(area, unsigned char);
- memset(state->immutable, FALSE, area);
+ memset(state->immutable, false, area);
state->blocks = alloc_block_structure (c, r, area, cr, cr);
@@ -4146,12 +4146,12 @@
state->kblocks = NULL;
state->kgrid = NULL;
}
- state->completed = state->cheated = FALSE;
+ state->completed = state->cheated = false;
desc = spec_to_grid(desc, state->grid, area);
for (i = 0; i < area; i++)
if (state->grid[i] != 0)
- state->immutable[i] = TRUE;
+ state->immutable[i] = true;
if (r == 1) {
const char *err;
@@ -4508,8 +4508,8 @@
* it unusable.
*/
if (params->killer)
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -4710,7 +4710,7 @@
const char *p;
ret = dup_game(from);
- ret->completed = ret->cheated = TRUE;
+ ret->completed = ret->cheated = true;
p = move+1;
for (n = 0; n < cr*cr; n++) {
@@ -4745,7 +4745,7 @@
if (!ret->completed && check_valid(
cr, ret->blocks, ret->kblocks, ret->kgrid,
ret->xtype, ret->grid)) {
- ret->completed = TRUE;
+ ret->completed = true;
}
}
return ret;
@@ -4839,7 +4839,7 @@
struct game_drawstate *ds = snew(struct game_drawstate);
int cr = state->cr;
- ds->started = FALSE;
+ ds->started = false;
ds->cr = cr;
ds->xtype = state->xtype;
ds->grid = snewn(cr*cr, digit);
@@ -5266,7 +5266,7 @@
*/
if (!ds->started) {
draw_update(dr, 0, 0, SIZE(cr), SIZE(cr));
- ds->started = TRUE;
+ ds->started = true;
}
}
@@ -5293,8 +5293,8 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
if (state->completed)
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -5538,10 +5538,10 @@
*/
if (state->kblocks) {
print_line_width(dr, TILE_SIZE / 40);
- print_line_dotted(dr, TRUE);
+ print_line_dotted(dr, true);
outline_block_structure(dr, ds, state, state->kblocks, ink,
5 * TILE_SIZE / 40);
- print_line_dotted(dr, FALSE);
+ print_line_dotted(dr, false);
for (y = 0; y < cr; y++)
for (x = 0; x < cr; x++)
if (state->kgrid[y*cr+x]) {
@@ -5586,7 +5586,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -5593,8 +5593,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -5611,9 +5611,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON | REQUIRE_NUMPAD, /* flags */
};
@@ -5625,15 +5625,15 @@
game_state *s;
char *id = NULL, *desc;
const char *err;
- int grade = FALSE;
+ int grade = false;
struct difficulty dlev;
while (--argc > 0) {
char *p = *++argv;
if (!strcmp(p, "-v")) {
- solver_show_working = TRUE;
+ solver_show_working = true;
} else if (!strcmp(p, "-g")) {
- grade = TRUE;
+ grade = true;
} else if (*p == '-') {
fprintf(stderr, "%s: unrecognised option `%s'\n", argv[0], p);
return 1;
--- a/tents.c
+++ b/tents.c
@@ -229,9 +229,9 @@
*/
#if defined STANDALONE_SOLVER
#define SOLVER_DIAGNOSTICS
-int verbose = FALSE;
+int verbose = false;
#elif defined SOLVER_DIAGNOSTICS
-#define verbose TRUE
+#define verbose true
#endif
/*
@@ -307,7 +307,7 @@
char str[80];
if (i < 0 || i >= lenof(tents_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = tents_presets[i];
@@ -316,7 +316,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -471,7 +471,7 @@
* Main solver loop.
*/
while (1) {
- int done_something = FALSE;
+ int done_something = false;
/*
* Any tent which has only one unattached tree adjacent to
@@ -512,7 +512,7 @@
sc->links[y*w+x] = linkd;
sc->links[y2*w+x2] = F(linkd);
- done_something = TRUE;
+ done_something = true;
}
}
@@ -528,7 +528,7 @@
for (y = 0; y < h; y++)
for (x = 0; x < w; x++)
if (soln[y*w+x] == BLANK) {
- int can_be_tent = FALSE;
+ int can_be_tent = false;
for (d = 1; d < MAXDIR; d++) {
int x2 = x + dx(d), y2 = y + dy(d);
@@ -535,7 +535,7 @@
if (x2 >= 0 && x2 < w && y2 >= 0 && y2 < h &&
soln[y2*w+x2] == TREE &&
!sc->links[y2*w+x2])
- can_be_tent = TRUE;
+ can_be_tent = true;
}
if (!can_be_tent) {
@@ -545,7 +545,7 @@
" unmatched tree)\n", x, y);
#endif
soln[y*w+x] = NONTENT;
- done_something = TRUE;
+ done_something = true;
}
}
@@ -559,7 +559,7 @@
for (y = 0; y < h; y++)
for (x = 0; x < w; x++)
if (soln[y*w+x] == BLANK) {
- int dx, dy, imposs = FALSE;
+ int dx, dy, imposs = false;
for (dy = -1; dy <= +1; dy++)
for (dx = -1; dx <= +1; dx++)
@@ -567,7 +567,7 @@
int x2 = x + dx, y2 = y + dy;
if (x2 >= 0 && x2 < w && y2 >= 0 && y2 < h &&
soln[y2*w+x2] == TENT)
- imposs = TRUE;
+ imposs = true;
}
if (imposs) {
@@ -577,7 +577,7 @@
x, y);
#endif
soln[y*w+x] = NONTENT;
- done_something = TRUE;
+ done_something = true;
}
}
@@ -625,7 +625,7 @@
soln[y2*w+x2] = TENT;
sc->links[y*w+x] = linkd;
sc->links[y2*w+x2] = F(linkd);
- done_something = TRUE;
+ done_something = true;
} else if (nd == 2 && (!dx(linkd) != !dx(linkd2)) &&
diff >= DIFF_TRICKY) {
/*
@@ -648,7 +648,7 @@
x, y, x2, y2);
#endif
soln[y2*w+x2] = NONTENT;
- done_something = TRUE;
+ done_something = true;
}
}
}
@@ -761,12 +761,12 @@
* placed, will have been dealt with already by
* other parts of the solver.)
*/
- valid = TRUE;
+ valid = true;
for (j = 0; j+1 < n; j++)
if (sc->place[j] == TENT &&
sc->place[j+1] == TENT &&
sc->locs[j+1] == sc->locs[j]+1) {
- valid = FALSE;
+ valid = false;
break;
}
@@ -868,7 +868,7 @@
pos % w, pos / w);
#endif
soln[pos] = mthis[j];
- done_something = TRUE;
+ done_something = true;
}
}
}
@@ -993,7 +993,7 @@
* is too few to fit the remaining tents into. */
for (i = 0; j > 0 && i+j <= w*h; i++) {
int which, x, y, d, tmp;
- int dy, dx, ok = TRUE;
+ int dy, dx, ok = true;
which = i + random_upto(rs, j);
tmp = order[which];
@@ -1008,7 +1008,7 @@
if (x+dx >= 0 && x+dx < w &&
y+dy >= 0 && y+dy < h &&
grid[(y+dy)*w+(x+dx)] == TENT)
- ok = FALSE;
+ ok = false;
if (ok) {
grid[order[i]] = TENT;
@@ -1236,7 +1236,7 @@
state->numbers = snew(struct numbers);
state->numbers->refcount = 1;
state->numbers->numbers = snewn(w+h, int);
- state->completed = state->used_solve = FALSE;
+ state->completed = state->used_solve = false;
i = 0;
memset(state->grid, BLANK, w*h);
@@ -1430,7 +1430,7 @@
ui->dsx = ui->dsy = -1;
ui->dex = ui->dey = -1;
ui->drag_button = -1;
- ui->drag_ok = FALSE;
+ ui->drag_ok = false;
ui->cx = ui->cy = ui->cdisp = 0;
return ui;
}
@@ -1552,7 +1552,7 @@
ui->drag_button = button;
ui->dsx = ui->dex = x;
ui->dsy = ui->dey = y;
- ui->drag_ok = TRUE;
+ ui->drag_ok = true;
ui->cdisp = 0;
return UI_UPDATE;
}
@@ -1567,7 +1567,7 @@
x = FROMCOORD(x);
y = FROMCOORD(y);
if (x < 0 || y < 0 || x >= w || y >= h) {
- ui->drag_ok = FALSE;
+ ui->drag_ok = false;
} else {
/*
* Drags are limited to one row or column. Hence, we
@@ -1582,7 +1582,7 @@
ui->dex = x;
ui->dey = y;
- ui->drag_ok = TRUE;
+ ui->drag_ok = true;
}
if (IS_MOUSE_DRAG(button))
@@ -1703,7 +1703,7 @@
c = *move;
if (c == 'S') {
int i;
- ret->used_solve = TRUE;
+ ret->used_solve = true;
/*
* Set all non-tree squares to NONTENT. The rest of the
* solve move will fill the tents in over the top.
@@ -1858,7 +1858,7 @@
/*
* We haven't managed to fault the grid on any count. Score!
*/
- ret->completed = TRUE;
+ ret->completed = true;
}
completion_check_done:
@@ -1935,7 +1935,7 @@
int i;
ds->tilesize = 0;
- ds->started = FALSE;
+ ds->started = false;
ds->p = state->p; /* structure copy */
ds->drawn = snewn(w*h, int);
for (i = 0; i < w*h; i++)
@@ -2410,7 +2410,7 @@
game_compute_size(&state->p, TILESIZE, &ww, &wh);
draw_rect(dr, 0, 0, ww, wh, COL_BACKGROUND);
draw_update(dr, 0, 0, ww, wh);
- ds->started = TRUE;
+ ds->started = true;
}
if (printing)
@@ -2428,7 +2428,7 @@
if (flashtime > 0)
flashing = (int)(flashtime * 3 / FLASH_TIME) != 1;
else
- flashing = FALSE;
+ flashing = false;
/*
* Find errors. For this we use _part_ of the information from a
@@ -2529,7 +2529,7 @@
int dir, const game_ui *ui,
float animtime, float flashtime)
{
- int_redraw(dr, ds, oldstate, state, dir, ui, animtime, flashtime, FALSE);
+ int_redraw(dr, ds, oldstate, state, dir, ui, animtime, flashtime, false);
}
static float game_anim_length(const game_state *oldstate,
@@ -2555,7 +2555,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2585,7 +2585,7 @@
c = print_mono_colour(dr, 0); assert(c == COL_TREELEAF);
c = print_mono_colour(dr, 0); assert(c == COL_TENT);
- int_redraw(dr, ds, NULL, state, +1, NULL, 0.0F, 0.0F, TRUE);
+ int_redraw(dr, ds, NULL, state, +1, NULL, 0.0F, 0.0F, true);
}
#ifdef COMBINED
@@ -2600,7 +2600,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2607,8 +2607,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2625,9 +2625,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON, /* flags */
};
@@ -2641,16 +2641,16 @@
game_state *s, *s2;
char *id = NULL, *desc;
const char *err;
- int grade = FALSE;
- int ret, diff, really_verbose = FALSE;
+ int grade = false;
+ int ret, diff, really_verbose = false;
struct solver_scratch *sc;
while (--argc > 0) {
char *p = *++argv;
if (!strcmp(p, "-v")) {
- really_verbose = TRUE;
+ really_verbose = true;
} else if (!strcmp(p, "-g")) {
- grade = TRUE;
+ grade = true;
} else if (*p == '-') {
fprintf(stderr, "%s: unrecognised option `%s'\n", argv[0], p);
return 1;
--- a/towers.c
+++ b/towers.c
@@ -146,7 +146,7 @@
char buf[80];
if (i < 0 || i >= lenof(towers_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = towers_presets[i]; /* structure copy */
@@ -155,7 +155,7 @@
*name = dupstr(buf);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -268,7 +268,7 @@
#endif
if (!ctx->started) {
- ctx->started = TRUE;
+ ctx->started = true;
/*
* One-off loop to help get started: when a pair of facing
* clues sum to w+1, it must mean that the row consists of
@@ -582,7 +582,7 @@
ctx.w = w;
ctx.diff = maxdiff;
ctx.clues = clues;
- ctx.started = FALSE;
+ ctx.started = false;
ctx.iscratch = snewn(w, long);
ctx.dscratch = snewn(w+1, int);
@@ -944,7 +944,7 @@
}
assert(!*p);
- state->completed = state->cheated = FALSE;
+ state->completed = state->cheated = false;
return state;
}
@@ -1021,7 +1021,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1199,7 +1199,7 @@
int W = w+2, A = W*W; /* the errors array is (w+2) square */
int *clues = state->clues->clues;
digit *grid = state->grid;
- int i, x, y, errs = FALSE;
+ int i, x, y, errs = false;
int tmp[32];
assert(w < lenof(tmp));
@@ -1217,12 +1217,12 @@
}
if (mask != (1L << (w+1)) - (1L << 1)) {
- errs = TRUE;
+ errs = true;
errmask &= ~1UL;
if (errors) {
for (x = 0; x < w; x++)
if (errmask & (1UL << grid[y*w+x]))
- errors[(y+1)*W+(x+1)] = TRUE;
+ errors[(y+1)*W+(x+1)] = true;
}
}
}
@@ -1236,12 +1236,12 @@
}
if (mask != (1 << (w+1)) - (1 << 1)) {
- errs = TRUE;
+ errs = true;
errmask &= ~1UL;
if (errors) {
for (y = 0; y < w; y++)
if (errmask & (1UL << grid[y*w+x]))
- errors[(y+1)*W+(x+1)] = TRUE;
+ errors[(y+1)*W+(x+1)] = true;
}
}
}
@@ -1269,9 +1269,9 @@
if (errors) {
int x, y;
CLUEPOS(x, y, i, w);
- errors[(y+1)*W+(x+1)] = TRUE;
+ errors[(y+1)*W+(x+1)] = true;
}
- errs = TRUE;
+ errs = true;
}
}
@@ -1298,10 +1298,10 @@
((y == -1 || y == w) && x >= 0 && x < w))
{
if (state->clues->clues[clue_index(state, x, y)] & DF_DIGIT_MASK)
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
static char *interpret_move(const game_state *state, game_ui *ui,
@@ -1460,7 +1460,7 @@
int x, y, i, n;
if (move[0] == 'S') {
- ret->completed = ret->cheated = TRUE;
+ ret->completed = ret->cheated = true;
for (i = 0; i < a; i++) {
if (move[i+1] < '1' || move[i+1] > '0'+w)
@@ -1486,7 +1486,7 @@
ret->pencil[y*w+x] = 0;
if (!ret->completed && !check_errors(ret, NULL))
- ret->completed = TRUE;
+ ret->completed = true;
}
return ret;
} else if (move[0] == 'M') {
@@ -1578,7 +1578,7 @@
ds->tilesize = 0;
ds->three_d = !getenv("TOWERS_2D");
- ds->started = FALSE;
+ ds->started = false;
ds->tiles = snewn((w+2)*(w+2), long);
ds->drawn = snewn((w+2)*(w+2)*4, long);
for (i = 0; i < (w+2)*(w+2)*4; i++)
@@ -1795,7 +1795,7 @@
draw_update(dr, 0, 0, SIZE(w), SIZE(w));
- ds->started = TRUE;
+ ds->started = true;
}
check_errors(state, ds->errtmp);
@@ -1906,8 +1906,8 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
if (state->completed)
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1999,7 +1999,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2006,8 +2006,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2024,9 +2024,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON | REQUIRE_NUMPAD, /* flags */
};
@@ -2040,15 +2040,15 @@
game_state *s;
char *id = NULL, *desc;
const char *err;
- int grade = FALSE;
- int ret, diff, really_show_working = FALSE;
+ int grade = false;
+ int ret, diff, really_show_working = false;
while (--argc > 0) {
char *p = *++argv;
if (!strcmp(p, "-v")) {
- really_show_working = TRUE;
+ really_show_working = true;
} else if (!strcmp(p, "-g")) {
- grade = TRUE;
+ grade = true;
} else if (*p == '-') {
fprintf(stderr, "%s: unrecognised option `%s'\n", argv[0], p);
return 1;
@@ -2084,7 +2084,7 @@
* the puzzle internally before doing anything else.
*/
ret = -1; /* placate optimiser */
- solver_show_working = FALSE;
+ solver_show_working = false;
for (diff = 0; diff < DIFFCOUNT; diff++) {
memcpy(s->grid, s->clues->immutable, p->w * p->w);
ret = solver(p->w, s->clues->clues, s->grid, diff);
--- a/tracks.c
+++ b/tracks.c
@@ -52,7 +52,7 @@
ret->w = ret->h = 8;
ret->diff = DIFF_TRICKY;
- ret->single_ones = TRUE;
+ ret->single_ones = true;
return ret;
}
@@ -76,7 +76,7 @@
char str[80];
if (i < 0 || i >= lenof(tracks_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = tracks_presets[i];
@@ -85,7 +85,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -118,9 +118,9 @@
params->diff = i;
if (*string) string++;
}
- params->single_ones = TRUE;
+ params->single_ones = true;
if (*string == 'o') {
- params->single_ones = FALSE;
+ params->single_ones = false;
string++;
}
@@ -324,7 +324,7 @@
memset(state->num_errors, 0, (w+h) * sizeof(int));
- state->completed = state->used_solve = state->impossible = FALSE;
+ state->completed = state->used_solve = state->impossible = false;
}
static game_state *blank_game(const game_params *params)
@@ -887,7 +887,7 @@
x, y, (f == S_TRACK ? "TRACK" : "NOTRACK"), why));
if (state->sflags[i] & (f == S_TRACK ? S_NOTRACK : S_TRACK)) {
debug(("solve: opposite flag already set there, marking IMPOSSIBLE"));
- state->impossible = TRUE;
+ state->impossible = true;
}
state->sflags[i] |= f;
return 1;
@@ -905,7 +905,7 @@
(f == S_TRACK ? "TRACK" : "NOTRACK"), why));
if (sf & (f == E_TRACK ? E_NOTRACK : E_TRACK)) {
debug(("solve: opposite flag already set there, marking IMPOSSIBLE"));
- state->impossible = TRUE;
+ state->impossible = true;
}
S_E_SET(state, x, y, d, f);
return 1;
@@ -1116,7 +1116,7 @@
if (nloose > (target - e2count)) {
debug(("check %s from (%d,%d): more loose (%d) than empty (%d), IMPOSSIBLE",
what, si%w, si/w, nloose, target-e2count));
- state->impossible = TRUE;
+ state->impossible = true;
}
if (nloose > 0 && nloose == (target - e2count)) {
debug(("check %s from (%d,%d): nloose = empty (%d), forcing loners out.",
@@ -1285,7 +1285,7 @@
int didsth, x, y, w = state->p.w, h = state->p.h;
debug(("solve..."));
- state->impossible = FALSE;
+ state->impossible = false;
/* Set all the outer border edges as no-track. */
for (x = 0; x < w; x++) {
@@ -1312,7 +1312,7 @@
if (!didsth || state->impossible) break;
}
- return state->impossible ? -1 : check_completion(state, FALSE) ? 1 : 0;
+ return state->impossible ? -1 : check_completion(state, false) ? 1 : 0;
}
static char *move_string_diff(const game_state *before, const game_state *after, int issolve)
@@ -1382,7 +1382,7 @@
*error = "Unable to find solution";
move = NULL;
} else {
- move = move_string_diff(currstate, solved, TRUE);
+ move = move_string_diff(currstate, solved, true);
}
free_game(solved);
@@ -1391,7 +1391,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1534,7 +1534,7 @@
static int check_completion(game_state *state, int mark)
{
- int w = state->p.w, h = state->p.h, x, y, i, target, ret = TRUE;
+ int w = state->p.w, h = state->p.h, x, y, i, target, ret = true;
int ntrack, nnotrack, ntrackcomplete;
int *dsf, pathclass;
struct findloopstate *fls;
@@ -1548,7 +1548,7 @@
state->sflags[i] &= ~S_ERROR;
if (S_E_COUNT(state, i%w, i/w, E_TRACK) > 0) {
if (S_E_COUNT(state, i%w, i/w, E_TRACK) > 2) {
- ret = FALSE;
+ ret = false;
state->sflags[i] |= S_ERROR;
}
}
@@ -1577,11 +1577,11 @@
debug(("col %d error: target %d, track %d, notrack %d",
x, target, ntrack, nnotrack));
state->num_errors[x] = 1;
- ret = FALSE;
+ ret = false;
}
}
if (ntrackcomplete != target)
- ret = FALSE;
+ ret = false;
}
for (y = 0; y < h; y++) {
target = state->numbers->numbers[w+y];
@@ -1600,11 +1600,11 @@
debug(("row %d error: target %d, track %d, notrack %d",
y, target, ntrack, nnotrack));
state->num_errors[w+y] = 1;
- ret = FALSE;
+ ret = false;
}
}
if (ntrackcomplete != target)
- ret = FALSE;
+ ret = false;
}
dsf = snewn(w*h, int);
@@ -1621,7 +1621,7 @@
ctx.state = state;
if (findloop_run(fls, w*h, tracks_neighbour, &ctx)) {
debug(("loop detected, not complete"));
- ret = FALSE; /* no loop allowed */
+ ret = false; /* no loop allowed */
if (mark) {
for (x = 0; x < w; x++) {
for (y = 0; y < h; y++) {
@@ -1647,7 +1647,7 @@
if ((dsf_canonify(dsf, i) != pathclass) &&
((state->sflags[i] & S_TRACK) ||
(S_E_COUNT(state, i%w, i/w, E_TRACK) > 0))) {
- ret = FALSE;
+ ret = false;
state->sflags[i] |= S_ERROR;
}
}
@@ -1656,7 +1656,7 @@
* can't be in a winning state. So even if we're not
* highlighting any _errors_, we certainly shouldn't
* return true. */
- ret = FALSE;
+ ret = false;
}
}
@@ -1674,7 +1674,7 @@
int clickx, clicky; /* pixel position of initial click */
int curx, cury; /* grid position of keyboard cursor; uses half-size grid */
- int cursor_active; /* TRUE iff cursor is shown */
+ int cursor_active; /* true iff cursor is shown */
};
static game_ui *new_ui(const game_state *state)
@@ -1683,7 +1683,7 @@
ui->clearing = ui->notrack = ui->dragging = 0;
ui->drag_sx = ui->drag_sy = ui->drag_ex = ui->drag_ey = -1;
- ui->cursor_active = FALSE;
+ ui->cursor_active = false;
ui->curx = ui->cury = 1;
return ui;
@@ -1753,15 +1753,15 @@
if (dy == 0) {
ui->drag_ex = gx < 0 ? 0 : gx >= w ? w-1 : gx;
ui->drag_ey = ui->drag_sy;
- ui->dragging = TRUE;
+ ui->dragging = true;
} else if (dx == 0) {
ui->drag_ex = ui->drag_sx;
ui->drag_ey = gy < 0 ? 0 : gy >= h ? h-1 : gy;
- ui->dragging = TRUE;
+ ui->dragging = true;
} else {
ui->drag_ex = ui->drag_sx;
ui->drag_ey = ui->drag_sy;
- ui->dragging = FALSE;
+ ui->dragging = false;
}
}
@@ -1774,12 +1774,12 @@
unsigned int sf1, sf2, ef;
if (!INGRID(state, x, y) || !INGRID(state, x2, y2))
- return FALSE;
+ return false;
sf1 = state->sflags[y*w + x];
sf2 = state->sflags[y2*w + x2];
if ( !notrack && ((sf1 & S_CLUE) || (sf2 & S_CLUE)) )
- return FALSE;
+ return false;
ef = S_E_FLAGS(state, x, y, dir);
if (notrack) {
@@ -1788,21 +1788,21 @@
could be set to TRACK, because we don't know which edges the general
square setting refers to. */
if (!(ef & E_NOTRACK) && (ef & E_TRACK))
- return FALSE;
+ return false;
} else {
if (!(ef & E_TRACK)) {
/* if we're going to _set_ TRACK, make sure neither adjacent square nor
the edge itself is already set to NOTRACK. */
if ((sf1 & S_NOTRACK) || (sf2 & S_NOTRACK) || (ef & E_NOTRACK))
- return FALSE;
+ return false;
/* if we're going to _set_ TRACK, make sure neither adjacent square has
2 track flags already. */
if ((S_E_COUNT(state, x, y, E_TRACK) >= 2) ||
(S_E_COUNT(state, x2, y2, E_TRACK) >= 2))
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
static int ui_can_flip_square(const game_state *state, int x, int y, int notrack)
@@ -1810,23 +1810,23 @@
int w = state->p.w, trackc;
unsigned sf;
- if (!INGRID(state, x, y)) return FALSE;
+ if (!INGRID(state, x, y)) return false;
sf = state->sflags[y*w+x];
trackc = S_E_COUNT(state, x, y, E_TRACK);
- if (sf & S_CLUE) return FALSE;
+ if (sf & S_CLUE) return false;
if (notrack) {
/* If we're setting S_NOTRACK, we cannot have either S_TRACK or any E_TRACK. */
if (!(sf & S_NOTRACK) && ((sf & S_TRACK) || (trackc > 0)))
- return FALSE;
+ return false;
} else {
/* If we're setting S_TRACK, we cannot have any S_NOTRACK (we could have
E_NOTRACK, though, because one or two wouldn't rule out a track) */
if (!(sf & S_TRACK) && (sf & S_NOTRACK))
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
static char *edge_flip_str(const game_state *state, int x, int y, int dir, int notrack, char *buf) {
@@ -1897,8 +1897,8 @@
/* --- mouse operations --- */
if (IS_MOUSE_DOWN(button)) {
- ui->cursor_active = FALSE;
- ui->dragging = FALSE;
+ ui->cursor_active = false;
+ ui->dragging = false;
if (!INGRID(state, gx, gy)) {
/* can't drag from off grid */
@@ -1906,10 +1906,10 @@
}
if (button == RIGHT_BUTTON) {
- ui->notrack = TRUE;
+ ui->notrack = true;
ui->clearing = state->sflags[gy*w+gx] & S_NOTRACK;
} else {
- ui->notrack = FALSE;
+ ui->notrack = false;
ui->clearing = state->sflags[gy*w+gx] & S_TRACK;
}
@@ -1922,17 +1922,17 @@
}
if (IS_MOUSE_DRAG(button)) {
- ui->cursor_active = FALSE;
+ ui->cursor_active = false;
update_ui_drag(state, ui, gx, gy);
return UI_UPDATE;
}
if (IS_MOUSE_RELEASE(button)) {
- ui->cursor_active = FALSE;
+ ui->cursor_active = false;
if (ui->dragging &&
(ui->drag_sx != ui->drag_ex || ui->drag_sy != ui->drag_ey)) {
game_state *dragged = copy_and_apply_drag(state, ui);
- char *ret = move_string_diff(state, dragged, FALSE);
+ char *ret = move_string_diff(state, dragged, false);
ui->dragging = 0;
free_game(dragged);
@@ -1992,7 +1992,7 @@
int dy = (button == CURSOR_DOWN) ? +1 : ((button == CURSOR_UP) ? -1 : 0);
if (!ui->cursor_active) {
- ui->cursor_active = TRUE;
+ ui->cursor_active = true;
return UI_UPDATE;
}
@@ -2009,7 +2009,7 @@
if (IS_CURSOR_SELECT(button)) {
if (!ui->cursor_active) {
- ui->cursor_active = TRUE;
+ ui->cursor_active = true;
return UI_UPDATE;
}
/* click on square corner does nothing (shouldn't get here) */
@@ -2052,7 +2052,7 @@
while (*move) {
c = *move;
if (c == 'S') {
- ret->used_solve = TRUE;
+ ret->used_solve = true;
move++;
} else if (c == 'T' || c == 't' || c == 'N' || c == 'n') {
/* set track, clear track; set notrack, clear notrack */
@@ -2094,7 +2094,7 @@
goto badmove;
}
- check_completion(ret, TRUE);
+ check_completion(ret, true);
return ret;
@@ -2186,7 +2186,7 @@
int i;
ds->sz6 = 0;
- ds->started = FALSE;
+ ds->started = false;
ds->w = state->p.w;
ds->h = state->p.h;
@@ -2507,7 +2507,7 @@
draw_update(dr, 0, 0, (w+2)*TILE_SIZE + 2*BORDER, (h+2)*TILE_SIZE + 2*BORDER);
- ds->started = TRUE;
+ ds->started = true;
force = 1;
}
@@ -2569,7 +2569,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2632,7 +2632,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2639,8 +2639,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2657,9 +2657,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/tree234.h
+++ b/tree234.h
@@ -164,9 +164,9 @@
/*
* Split a tree234 into two valid tree234s.
*
- * splitpos234 splits at a given index. If `before' is TRUE, the
+ * splitpos234 splits at a given index. If `before' is true, the
* items at and after that index are left in t and the ones before
- * are returned; if `before' is FALSE, the items before that index
+ * are returned; if `before' is false, the items before that index
* are left in t and the rest are returned.
*
* split234 splits at a given key. You can pass any of the
--- a/twiddle.c
+++ b/twiddle.c
@@ -58,7 +58,7 @@
ret->w = ret->h = 3;
ret->n = 2;
- ret->rowsonly = ret->orientable = FALSE;
+ ret->rowsonly = ret->orientable = false;
ret->movetarget = 0;
return ret;
@@ -83,23 +83,23 @@
const char *title;
game_params params;
} const presets[] = {
- { "3x3 rows only", { 3, 3, 2, TRUE, FALSE } },
- { "3x3 normal", { 3, 3, 2, FALSE, FALSE } },
- { "3x3 orientable", { 3, 3, 2, FALSE, TRUE } },
- { "4x4 normal", { 4, 4, 2, FALSE } },
- { "4x4 orientable", { 4, 4, 2, FALSE, TRUE } },
- { "4x4, rotating 3x3 blocks", { 4, 4, 3, FALSE } },
- { "5x5, rotating 3x3 blocks", { 5, 5, 3, FALSE } },
- { "6x6, rotating 4x4 blocks", { 6, 6, 4, FALSE } },
+ { "3x3 rows only", { 3, 3, 2, true, false } },
+ { "3x3 normal", { 3, 3, 2, false, false } },
+ { "3x3 orientable", { 3, 3, 2, false, true } },
+ { "4x4 normal", { 4, 4, 2, false } },
+ { "4x4 orientable", { 4, 4, 2, false, true } },
+ { "4x4, rotating 3x3 blocks", { 4, 4, 3, false } },
+ { "5x5, rotating 3x3 blocks", { 5, 5, 3, false } },
+ { "6x6, rotating 4x4 blocks", { 6, 6, 4, false } },
};
if (i < 0 || i >= lenof(presets))
- return FALSE;
+ return false;
*name = dupstr(presets[i].title);
*params = dup_params(&presets[i].params);
- return TRUE;
+ return true;
}
static void decode_params(game_params *ret, char const *string)
@@ -106,7 +106,7 @@
{
ret->w = ret->h = atoi(string);
ret->n = 2;
- ret->rowsonly = ret->orientable = FALSE;
+ ret->rowsonly = ret->orientable = false;
ret->movetarget = 0;
while (*string && isdigit((unsigned char)*string)) string++;
if (*string == 'x') {
@@ -121,9 +121,9 @@
}
while (*string) {
if (*string == 'r') {
- ret->rowsonly = TRUE;
+ ret->rowsonly = true;
} else if (*string == 'o') {
- ret->orientable = TRUE;
+ ret->orientable = true;
} else if (*string == 'm') {
string++;
ret->movetarget = atoi(string);
@@ -285,15 +285,15 @@
static int grid_complete(int *grid, int wh, int orientable)
{
- int ok = TRUE;
+ int ok = true;
int i;
for (i = 1; i < wh; i++)
if (grid[i] < grid[i-1])
- ok = FALSE;
+ ok = false;
if (orientable) {
for (i = 0; i < wh; i++)
if (grid[i] & 3)
- ok = FALSE;
+ ok = false;
}
return ok;
}
@@ -464,7 +464,7 @@
state->n = n;
state->orientable = params->orientable;
state->completed = 0;
- state->used_solve = FALSE;
+ state->used_solve = false;
state->movecount = 0;
state->movetarget = params->movetarget;
state->lastx = state->lasty = state->lastr = -1;
@@ -540,7 +540,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -601,7 +601,7 @@
ui->cur_x = 0;
ui->cur_y = 0;
- ui->cur_visible = FALSE;
+ ui->cur_visible = false;
return ui;
}
@@ -745,7 +745,7 @@
qsort(ret->grid, ret->w*ret->h, sizeof(int), compare_int);
for (i = 0; i < ret->w*ret->h; i++)
ret->grid[i] &= ~3;
- ret->used_solve = TRUE;
+ ret->used_solve = true;
ret->completed = ret->movecount = 1;
return ret;
@@ -821,7 +821,7 @@
struct game_drawstate *ds = snew(struct game_drawstate);
int i;
- ds->started = FALSE;
+ ds->started = false;
ds->w = state->w;
ds->h = state->h;
ds->bgcolour = COL_BACKGROUND;
@@ -1133,7 +1133,7 @@
coords[0] = COORD(0) - HIGHLIGHT_WIDTH;
draw_polygon(dr, coords, 5, COL_LOWLIGHT, COL_LOWLIGHT);
- ds->started = TRUE;
+ ds->started = true;
}
/*
@@ -1255,7 +1255,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1278,7 +1278,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1285,8 +1285,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1303,9 +1303,9 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/undead.c
+++ b/undead.c
@@ -96,7 +96,7 @@
game_params *ret;
char buf[64];
- if (i < 0 || i >= lenof(undead_presets)) return FALSE;
+ if (i < 0 || i >= lenof(undead_presets)) return false;
ret = default_params();
*ret = undead_presets[i]; /* struct copy */
@@ -107,7 +107,7 @@
undead_diffnames[undead_presets[i].diff]);
*name = dupstr(buf);
- return TRUE;
+ return true;
}
static void free_params(game_params *params) {
@@ -281,18 +281,18 @@
state->cell_errors = snewn(state->common->wh, unsigned char);
for (i=0;i<state->common->wh;i++)
- state->cell_errors[i] = FALSE;
+ state->cell_errors[i] = false;
state->hint_errors = snewn(2*state->common->num_paths, unsigned char);
for (i=0;i<2*state->common->num_paths;i++)
- state->hint_errors[i] = FALSE;
+ state->hint_errors[i] = false;
state->hints_done = snewn(2 * state->common->num_paths, unsigned char);
memset(state->hints_done, 0,
2 * state->common->num_paths * sizeof(unsigned char));
for (i=0;i<3;i++)
- state->count_errors[i] = FALSE;
+ state->count_errors[i] = false;
- state->solved = FALSE;
- state->cheated = FALSE;
+ state->solved = false;
+ state->cheated = false;
return state;
}
@@ -440,11 +440,11 @@
int j,k,num_monsters;
int found;
int c,p;
- found = FALSE;
+ found = false;
/* Check whether inverse path is already in list */
for (j=0;j<count;j++) {
if (i == state->common->paths[j].grid_end) {
- found = TRUE;
+ found = true;
break;
}
}
@@ -456,7 +456,7 @@
state->common->params.h,&x,&y);
state->common->paths[count].sightings_start =
state->common->grid[x+y*(state->common->params.w +2)];
- while (TRUE) {
+ while (true) {
int c,r;
if (dir == DIRECTION_DOWN) y++;
@@ -513,9 +513,9 @@
int m;
m = state->common->paths[count].p[p];
if (m == -1) continue;
- found = FALSE;
+ found = false;
for (j=0; j<c; j++)
- if (state->common->paths[count].mapping[j] == m) found = TRUE;
+ if (state->common->paths[count].mapping[j] == m) found = true;
if (!found) state->common->paths[count].mapping[c++] = m;
}
count++;
@@ -536,16 +536,16 @@
(g->guess[pos] == 2 && (g->possible[pos] == 3 ||
g->possible[pos] == 2)) ||
g->guess[pos] == 4)
- return FALSE;
+ return false;
if (g->guess[pos] == 1 && (g->possible[pos] == 3 ||
g->possible[pos] == 7)) {
- g->guess[pos] = 2; return TRUE;
+ g->guess[pos] = 2; return true;
}
if (g->guess[pos] == 1 && g->possible[pos] == 5) {
- g->guess[pos] = 4; return TRUE;
+ g->guess[pos] = 4; return true;
}
if (g->guess[pos] == 2 && (g->possible[pos] == 6 || g->possible[pos] == 7)) {
- g->guess[pos] = 4; return TRUE;
+ g->guess[pos] = 4; return true;
}
}
@@ -554,10 +554,10 @@
return next_list(g,pos-1);
}
if (g->possible[pos] == 3 || g->possible[pos] == 7) {
- g->guess[pos] = 2; return TRUE;
+ g->guess[pos] = 2; return true;
}
if (g->possible[pos] == 5) {
- g->guess[pos] = 4; return TRUE;
+ g->guess[pos] = 4; return true;
}
}
@@ -569,7 +569,7 @@
g->guess[pos] = 1; return next_list(g,pos-1);
}
if (g->possible[pos] == 6 || g->possible[pos] == 7) {
- g->guess[pos] = 4; return TRUE;
+ g->guess[pos] = 4; return true;
}
}
@@ -584,7 +584,7 @@
return next_list(g,pos-1);
}
}
- return FALSE;
+ return false;
}
void get_unique(game_state *state, int counter, random_state *rs) {
@@ -638,17 +638,17 @@
do {
int mirror, start_view, end_view;
- mirror = FALSE;
+ mirror = false;
start_view = 0;
for (p=0;p<state->common->paths[counter].length;p++) {
- if (state->common->paths[counter].p[p] == -1) mirror = TRUE;
+ if (state->common->paths[counter].p[p] == -1) mirror = true;
else {
for (i=0;i<path_guess.length;i++) {
if (state->common->paths[counter].p[p] ==
state->common->paths[counter].mapping[i]) {
- if (path_guess.guess[i] == 1 && mirror == TRUE)
+ if (path_guess.guess[i] == 1 && mirror == true)
start_view++;
- if (path_guess.guess[i] == 2 && mirror == FALSE)
+ if (path_guess.guess[i] == 2 && mirror == false)
start_view++;
if (path_guess.guess[i] == 4)
start_view++;
@@ -657,17 +657,17 @@
}
}
}
- mirror = FALSE;
+ mirror = false;
end_view = 0;
for (p=state->common->paths[counter].length-1;p>=0;p--) {
- if (state->common->paths[counter].p[p] == -1) mirror = TRUE;
+ if (state->common->paths[counter].p[p] == -1) mirror = true;
else {
for (i=0;i<path_guess.length;i++) {
if (state->common->paths[counter].p[p] ==
state->common->paths[counter].mapping[i]) {
- if (path_guess.guess[i] == 1 && mirror == TRUE)
+ if (path_guess.guess[i] == 1 && mirror == true)
end_view++;
- if (path_guess.guess[i] == 2 && mirror == FALSE)
+ if (path_guess.guess[i] == 2 && mirror == false)
end_view++;
if (path_guess.guess[i] == 4)
end_view++;
@@ -793,11 +793,11 @@
if (guess[i] == 4) count_zombies++;
}
- valid = TRUE;
+ valid = true;
- if (count_ghosts > state->common->num_ghosts) valid = FALSE;
- if (count_vampires > state->common->num_vampires) valid = FALSE;
- if (count_zombies > state->common->num_zombies) valid = FALSE;
+ if (count_ghosts > state->common->num_ghosts) valid = false;
+ if (count_vampires > state->common->num_vampires) valid = false;
+ if (count_zombies > state->common->num_zombies) valid = false;
return valid;
}
@@ -808,9 +808,9 @@
int count;
count = 0;
- mirror = FALSE;
+ mirror = false;
for (i=0;i<path.length;i++) {
- if (path.p[i] == -1) mirror = TRUE;
+ if (path.p[i] == -1) mirror = true;
else {
if (g[path.p[i]] == 1 && mirror) count++;
else if (g[path.p[i]] == 2 && !mirror) count++;
@@ -817,12 +817,12 @@
else if (g[path.p[i]] == 4) count++;
}
}
- if (count != path.sightings_start) return FALSE;
+ if (count != path.sightings_start) return false;
count = 0;
- mirror = FALSE;
+ mirror = false;
for (i=path.length-1;i>=0;i--) {
- if (path.p[i] == -1) mirror = TRUE;
+ if (path.p[i] == -1) mirror = true;
else {
if (g[path.p[i]] == 1 && mirror) count++;
else if (g[path.p[i]] == 2 && !mirror) count++;
@@ -829,9 +829,9 @@
else if (g[path.p[i]] == 4) count++;
}
}
- if (count != path.sightings_end) return FALSE;
+ if (count != path.sightings_end) return false;
- return TRUE;
+ return true;
}
int solve_iterative(game_state *state, struct path *paths) {
@@ -843,7 +843,7 @@
struct guess loop;
- solved = TRUE;
+ solved = true;
loop.length = state->common->num_total;
guess = snewn(state->common->num_total,int);
possible = snewn(state->common->num_total,int);
@@ -873,7 +873,7 @@
possible[paths[p].mapping[i]] = 0;
}
- while(TRUE) {
+ while(true) {
for (i=0;i<state->common->num_total;i++) {
guess[i] = state->guess[i];
}
@@ -897,7 +897,7 @@
for (i=0;i<state->common->num_total;i++) {
if (state->guess[i] == 3 || state->guess[i] == 5 ||
state->guess[i] == 6 || state->guess[i] == 7) {
- solved = FALSE; break;
+ solved = false; break;
}
}
@@ -930,23 +930,23 @@
}
}
- solved = FALSE;
+ solved = false;
number_solutions = 0;
- while (TRUE) {
+ while (true) {
- correct = TRUE;
- if (!check_numbers(state,loop.guess)) correct = FALSE;
+ correct = true;
+ if (!check_numbers(state,loop.guess)) correct = false;
else
for (p=0;p<state->common->num_paths;p++)
if (!check_solution(loop.guess,paths[p])) {
- correct = FALSE; break;
+ correct = false; break;
}
if (correct) {
number_solutions++;
- solved = TRUE;
+ solved = true;
if(number_solutions > 1) {
- solved = FALSE;
+ solved = false;
break;
}
for (i=0;i<state->common->num_total;i++)
@@ -993,9 +993,9 @@
char *desc;
i = 0;
- while (TRUE) {
+ while (true) {
new = new_state(params);
- abort = FALSE;
+ abort = false;
/* Fill grid with random mirrors and (later to be populated)
* empty monster cells */
@@ -1062,7 +1062,7 @@
* puzzle generator; initialize it for having clean code */
new->common->fixed = snewn(new->common->num_total,int);
for (g=0;g<new->common->num_total;g++)
- new->common->fixed[g] = FALSE;
+ new->common->fixed[g] = false;
/* paths generation */
make_paths(new);
@@ -1078,7 +1078,7 @@
for (p=0;p<new->common->num_paths;p++) {
if (new->common->paths[p].num_monsters > max_length) {
- abort = TRUE;
+ abort = true;
}
}
if (abort) {
@@ -1161,23 +1161,23 @@
new->common->paths[p].sightings_start = 0;
new->common->paths[p].sightings_end = 0;
- mirror = FALSE;
+ mirror = false;
for (g=0;g<new->common->paths[p].length;g++) {
- if (new->common->paths[p].p[g] == -1) mirror = TRUE;
+ if (new->common->paths[p].p[g] == -1) mirror = true;
else {
- if (new->guess[new->common->paths[p].p[g]] == 1 && mirror == TRUE) (new->common->paths[p].sightings_start)++;
- else if (new->guess[new->common->paths[p].p[g]] == 2 && mirror == FALSE) (new->common->paths[p].sightings_start)++;
+ if (new->guess[new->common->paths[p].p[g]] == 1 && mirror == true) (new->common->paths[p].sightings_start)++;
+ else if (new->guess[new->common->paths[p].p[g]] == 2 && mirror == false) (new->common->paths[p].sightings_start)++;
else if (new->guess[new->common->paths[p].p[g]] == 4) (new->common->paths[p].sightings_start)++;
}
}
- mirror = FALSE;
+ mirror = false;
for (g=new->common->paths[p].length-1;g>=0;g--) {
- if (new->common->paths[p].p[g] == -1) mirror = TRUE;
+ if (new->common->paths[p].p[g] == -1) mirror = true;
else {
- if (new->guess[new->common->paths[p].p[g]] == 1 && mirror == TRUE) (new->common->paths[p].sightings_end)++;
- else if (new->guess[new->common->paths[p].p[g]] == 2 && mirror == FALSE) (new->common->paths[p].sightings_end)++;
+ if (new->guess[new->common->paths[p].p[g]] == 1 && mirror == true) (new->common->paths[p].sightings_end)++;
+ else if (new->guess[new->common->paths[p].p[g]] == 2 && mirror == false) (new->common->paths[p].sightings_end)++;
else if (new->guess[new->common->paths[p].p[g]] == 4) (new->common->paths[p].sightings_end)++;
}
}
@@ -1199,25 +1199,25 @@
old_guess[p] = 7;
}
iterative_depth = 0;
- solved_iterative = FALSE;
- contains_inconsistency = FALSE;
+ solved_iterative = false;
+ contains_inconsistency = false;
count_ambiguous = 0;
- while (TRUE) {
+ while (true) {
int no_change;
- no_change = TRUE;
+ no_change = true;
solved_iterative = solve_iterative(new,new->common->paths);
iterative_depth++;
for (p=0;p<new->common->num_total;p++) {
- if (new->guess[p] != old_guess[p]) no_change = FALSE;
+ if (new->guess[p] != old_guess[p]) no_change = false;
old_guess[p] = new->guess[p];
- if (new->guess[p] == 0) contains_inconsistency = TRUE;
+ if (new->guess[p] == 0) contains_inconsistency = true;
}
if (solved_iterative || no_change) break;
}
/* If necessary, try to solve the puzzle with the brute-force solver */
- solved_bruteforce = FALSE;
+ solved_bruteforce = false;
if (new->common->params.diff != DIFF_EASY &&
!solved_iterative && !contains_inconsistency) {
for (p=0;p<new->common->num_total;p++)
@@ -1359,14 +1359,14 @@
for (i=0;i<state->common->num_total;i++) {
state->guess[i] = 7;
state->pencils[i] = 0;
- state->common->fixed[i] = FALSE;
+ state->common->fixed[i] = false;
}
for (i=0;i<state->common->wh;i++)
- state->cell_errors[i] = FALSE;
+ state->cell_errors[i] = false;
for (i=0;i<2*state->common->num_paths;i++)
- state->hint_errors[i] = FALSE;
+ state->hint_errors[i] = false;
for (i=0;i<3;i++)
- state->count_errors[i] = FALSE;
+ state->count_errors[i] = false;
count = 0;
n = 0;
@@ -1391,7 +1391,7 @@
state->common->grid[x+y*(state->common->params.w +2)] = CELL_GHOST;
state->common->xinfo[x+y*(state->common->params.w+2)] = count;
state->guess[count] = 1;
- state->common->fixed[count++] = TRUE;
+ state->common->fixed[count++] = true;
n++;
}
else if (*desc == 'V') {
@@ -1399,7 +1399,7 @@
state->common->grid[x+y*(state->common->params.w +2)] = CELL_VAMPIRE;
state->common->xinfo[x+y*(state->common->params.w+2)] = count;
state->guess[count] = 2;
- state->common->fixed[count++] = TRUE;
+ state->common->fixed[count++] = true;
n++;
}
else if (*desc == 'Z') {
@@ -1407,7 +1407,7 @@
state->common->grid[x+y*(state->common->params.w +2)] = CELL_ZOMBIE;
state->common->xinfo[x+y*(state->common->params.w+2)] = count;
state->guess[count] = 4;
- state->common->fixed[count++] = TRUE;
+ state->common->fixed[count++] = true;
n++;
}
else {
@@ -1417,7 +1417,7 @@
state->common->grid[x+y*(state->common->params.w +2)] = CELL_EMPTY;
state->common->xinfo[x+y*(state->common->params.w+2)] = count;
state->guess[count] = 7;
- state->common->fixed[count++] = FALSE;
+ state->common->fixed[count++] = false;
n++;
}
}
@@ -1530,21 +1530,21 @@
}
}
iterative_depth = 0;
- solved_iterative = FALSE;
- contains_inconsistency = FALSE;
+ solved_iterative = false;
+ contains_inconsistency = false;
count_ambiguous = 0;
/* Try to solve the puzzle with the iterative solver */
- while (TRUE) {
+ while (true) {
int no_change;
- no_change = TRUE;
+ no_change = true;
solved_iterative =
solve_iterative(solve_state,solve_state->common->paths);
iterative_depth++;
for (p=0;p<solve_state->common->num_total;p++) {
- if (solve_state->guess[p] != old_guess[p]) no_change = FALSE;
+ if (solve_state->guess[p] != old_guess[p]) no_change = false;
old_guess[p] = solve_state->guess[p];
- if (solve_state->guess[p] == 0) contains_inconsistency = TRUE;
+ if (solve_state->guess[p] == 0) contains_inconsistency = true;
}
if (solved_iterative || no_change || contains_inconsistency) break;
}
@@ -1557,7 +1557,7 @@
}
/* If necessary, try to solve the puzzle with the brute-force solver */
- solved_bruteforce = FALSE;
+ solved_bruteforce = false;
if (!solved_iterative) {
for (p=0;p<solve_state->common->num_total;p++)
if (solve_state->guess[p] != 1 && solve_state->guess[p] != 2 &&
@@ -1593,7 +1593,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1647,7 +1647,7 @@
game_ui *ui = snew(game_ui);
ui->hx = ui->hy = 0;
ui->hpencil = ui->hshow = ui->hcursor = 0;
- ui->ascii = FALSE;
+ ui->ascii = false;
return ui;
}
@@ -1702,9 +1702,9 @@
if (((x == 0 || x == w + 1) && y > 0 && y <= h) ||
((y == 0 || y == h + 1) && x > 0 && x <= w))
- return TRUE;
+ return true;
- return FALSE;
+ return false;
}
static int clue_index(const game_state *state, int x, int y)
@@ -1899,44 +1899,44 @@
if (guess[i] == 4) count_zombies++;
}
- valid = TRUE;
+ valid = true;
filled = (count_ghosts + count_vampires + count_zombies >=
state->common->num_total);
if (count_ghosts > state->common->num_ghosts ||
(filled && count_ghosts != state->common->num_ghosts) ) {
- valid = FALSE;
- state->count_errors[0] = TRUE;
+ valid = false;
+ state->count_errors[0] = true;
for (x=1;x<state->common->params.w+1;x++)
for (y=1;y<state->common->params.h+1;y++) {
xy = x+y*(state->common->params.w+2);
if (state->common->xinfo[xy] >= 0 &&
guess[state->common->xinfo[xy]] == 1)
- state->cell_errors[xy] = TRUE;
+ state->cell_errors[xy] = true;
}
}
if (count_vampires > state->common->num_vampires ||
(filled && count_vampires != state->common->num_vampires) ) {
- valid = FALSE;
- state->count_errors[1] = TRUE;
+ valid = false;
+ state->count_errors[1] = true;
for (x=1;x<state->common->params.w+1;x++)
for (y=1;y<state->common->params.h+1;y++) {
xy = x+y*(state->common->params.w+2);
if (state->common->xinfo[xy] >= 0 &&
guess[state->common->xinfo[xy]] == 2)
- state->cell_errors[xy] = TRUE;
+ state->cell_errors[xy] = true;
}
}
if (count_zombies > state->common->num_zombies ||
(filled && count_zombies != state->common->num_zombies) ) {
- valid = FALSE;
- state->count_errors[2] = TRUE;
+ valid = false;
+ state->count_errors[2] = true;
for (x=1;x<state->common->params.w+1;x++)
for (y=1;y<state->common->params.h+1;y++) {
xy = x+y*(state->common->params.w+2);
if (state->common->xinfo[xy] >= 0 &&
guess[state->common->xinfo[xy]] == 4)
- state->cell_errors[xy] = TRUE;
+ state->cell_errors[xy] = true;
}
}
@@ -1951,12 +1951,12 @@
int unfilled;
count = 0;
- mirror = FALSE;
- correct = TRUE;
+ mirror = false;
+ correct = true;
unfilled = 0;
for (i=0;i<state->common->paths[p].length;i++) {
- if (state->common->paths[p].p[i] == -1) mirror = TRUE;
+ if (state->common->paths[p].p[i] == -1) mirror = true;
else {
if (state->guess[state->common->paths[p].p[i]] == 1 && mirror)
count++;
@@ -1972,15 +1972,15 @@
if (count > state->common->paths[p].sightings_start ||
count + unfilled < state->common->paths[p].sightings_start)
{
- correct = FALSE;
- state->hint_errors[state->common->paths[p].grid_start] = TRUE;
+ correct = false;
+ state->hint_errors[state->common->paths[p].grid_start] = true;
}
count = 0;
- mirror = FALSE;
+ mirror = false;
unfilled = 0;
for (i=state->common->paths[p].length-1;i>=0;i--) {
- if (state->common->paths[p].p[i] == -1) mirror = TRUE;
+ if (state->common->paths[p].p[i] == -1) mirror = true;
else {
if (state->guess[state->common->paths[p].p[i]] == 1 && mirror)
count++;
@@ -1996,13 +1996,13 @@
if (count > state->common->paths[p].sightings_end ||
count + unfilled < state->common->paths[p].sightings_end)
{
- correct = FALSE;
- state->hint_errors[state->common->paths[p].grid_end] = TRUE;
+ correct = false;
+ state->hint_errors[state->common->paths[p].grid_end] = true;
}
if (!correct) {
for (i=0;i<state->common->paths[p].length;i++)
- state->cell_errors[state->common->paths[p].xy[i]] = TRUE;
+ state->cell_errors[state->common->paths[p].xy[i]] = true;
}
return correct;
@@ -2016,13 +2016,13 @@
int solver;
game_state *ret = dup_game(state);
- solver = FALSE;
+ solver = false;
while (*move) {
c = *move;
if (c == 'S') {
move++;
- solver = TRUE;
+ solver = true;
}
if (c == 'G' || c == 'V' || c == 'Z' || c == 'E' ||
c == 'g' || c == 'v' || c == 'z') {
@@ -2057,23 +2057,23 @@
if (*move == ';') move++;
}
- correct = TRUE;
+ correct = true;
- for (i=0;i<ret->common->wh;i++) ret->cell_errors[i] = FALSE;
- for (i=0;i<2*ret->common->num_paths;i++) ret->hint_errors[i] = FALSE;
- for (i=0;i<3;i++) ret->count_errors[i] = FALSE;
+ for (i=0;i<ret->common->wh;i++) ret->cell_errors[i] = false;
+ for (i=0;i<2*ret->common->num_paths;i++) ret->hint_errors[i] = false;
+ for (i=0;i<3;i++) ret->count_errors[i] = false;
- if (!check_numbers_draw(ret,ret->guess)) correct = FALSE;
+ if (!check_numbers_draw(ret,ret->guess)) correct = false;
for (p=0;p<state->common->num_paths;p++)
- if (!check_path_solution(ret,p)) correct = FALSE;
+ if (!check_path_solution(ret,p)) correct = false;
for (i=0;i<state->common->num_total;i++)
if (!(ret->guess[i] == 1 || ret->guess[i] == 2 ||
- ret->guess[i] == 4)) correct = FALSE;
+ ret->guess[i] == 4)) correct = false;
- if (correct && !solver) ret->solved = TRUE;
- if (solver) ret->cheated = TRUE;
+ if (correct && !solver) ret->solved = true;
+ if (solver) ret->cheated = true;
return ret;
}
@@ -2157,14 +2157,14 @@
struct game_drawstate *ds = snew(struct game_drawstate);
ds->tilesize = 0;
- ds->started = ds->solved = FALSE;
+ ds->started = ds->solved = false;
ds->w = state->common->params.w;
ds->h = state->common->params.h;
- ds->ascii = FALSE;
+ ds->ascii = false;
- ds->count_errors[0] = FALSE;
- ds->count_errors[1] = FALSE;
- ds->count_errors[2] = FALSE;
+ ds->count_errors[0] = false;
+ ds->count_errors[1] = false;
+ ds->count_errors[2] = false;
ds->monsters = snewn(state->common->num_total,int);
for (i=0;i<(state->common->num_total);i++)
@@ -2175,10 +2175,10 @@
ds->cell_errors = snewn(state->common->wh,unsigned char);
for (i=0;i<state->common->wh;i++)
- ds->cell_errors[i] = FALSE;
+ ds->cell_errors[i] = false;
ds->hint_errors = snewn(2*state->common->num_paths,unsigned char);
for (i=0;i<2*state->common->num_paths;i++)
- ds->hint_errors[i] = FALSE;
+ ds->hint_errors[i] = false;
ds->hints_done = snewn(2 * state->common->num_paths, unsigned char);
memset(ds->hints_done, 0,
2 * state->common->num_paths * sizeof(unsigned char));
@@ -2540,18 +2540,18 @@
static int is_hint_stale(const game_drawstate *ds, int hflash,
const game_state *state, int index)
{
- int ret = FALSE;
- if (!ds->started) ret = TRUE;
- if (ds->hflash != hflash) ret = TRUE;
+ int ret = false;
+ if (!ds->started) ret = true;
+ if (ds->hflash != hflash) ret = true;
if (ds->hint_errors[index] != state->hint_errors[index]) {
ds->hint_errors[index] = state->hint_errors[index];
- ret = TRUE;
+ ret = true;
}
if (ds->hints_done[index] != state->hints_done[index]) {
ds->hints_done[index] = state->hints_done[index];
- ret = TRUE;
+ ret = true;
}
return ret;
@@ -2582,26 +2582,26 @@
2*BORDER+(ds->h+3)*TILESIZE);
}
- hchanged = FALSE;
+ hchanged = false;
if (ds->hx != ui->hx || ds->hy != ui->hy ||
ds->hshow != ui->hshow || ds->hpencil != ui->hpencil)
- hchanged = TRUE;
+ hchanged = true;
if (ds->ascii != ui->ascii) {
ds->ascii = ui->ascii;
- changed_ascii = TRUE;
+ changed_ascii = true;
} else
- changed_ascii = FALSE;
+ changed_ascii = false;
/* Draw monster count hints */
for (i=0;i<3;i++) {
- stale = FALSE;
- if (!ds->started) stale = TRUE;
- if (ds->hflash != hflash) stale = TRUE;
- if (changed_ascii) stale = TRUE;
+ stale = false;
+ if (!ds->started) stale = true;
+ if (ds->hflash != hflash) stale = true;
+ if (changed_ascii) stale = true;
if (ds->count_errors[i] != state->count_errors[i]) {
- stale = TRUE;
+ stale = true;
ds->count_errors[i] = state->count_errors[i];
}
@@ -2628,33 +2628,33 @@
/* Draw puzzle grid contents */
for (x = 1; x < ds->w+1; x++)
for (y = 1; y < ds->h+1; y++) {
- stale = FALSE;
+ stale = false;
xy = x+y*(state->common->params.w+2);
xi = state->common->xinfo[xy];
c = state->common->grid[xy];
- if (!ds->started) stale = TRUE;
- if (ds->hflash != hflash) stale = TRUE;
- if (changed_ascii) stale = TRUE;
+ if (!ds->started) stale = true;
+ if (ds->hflash != hflash) stale = true;
+ if (changed_ascii) stale = true;
if (hchanged) {
if ((x == ui->hx && y == ui->hy) ||
(x == ds->hx && y == ds->hy))
- stale = TRUE;
+ stale = true;
}
if (xi >= 0 && (state->guess[xi] != ds->monsters[xi]) ) {
- stale = TRUE;
+ stale = true;
ds->monsters[xi] = state->guess[xi];
}
if (xi >= 0 && (state->pencils[xi] != ds->pencils[xi]) ) {
- stale = TRUE;
+ stale = true;
ds->pencils[xi] = state->pencils[xi];
}
if (state->cell_errors[xy] != ds->cell_errors[xy]) {
- stale = TRUE;
+ stale = true;
ds->cell_errors[xy] = state->cell_errors[xy];
}
@@ -2674,7 +2674,7 @@
ds->hshow = ui->hshow;
ds->hpencil = ui->hpencil;
ds->hflash = hflash;
- ds->started = TRUE;
+ ds->started = true;
return;
}
@@ -2698,7 +2698,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2721,7 +2721,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2728,8 +2728,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2746,8 +2746,8 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/unequal.c
+++ b/unequal.c
@@ -132,7 +132,7 @@
char buf[80];
if (i < 0 || i >= lenof(unequal_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = unequal_presets[i]; /* structure copy */
@@ -144,7 +144,7 @@
*name = dupstr(buf);
*params = ret;
- return TRUE;
+ return true;
}
static game_params *default_params(void)
@@ -451,7 +451,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -642,7 +642,7 @@
j+1, link->gx+1, link->gy+1);
}
#endif
- cube(link->gx, link->gy, j+1) = FALSE;
+ cube(link->gx, link->gy, j+1) = false;
nchanged++;
}
}
@@ -660,7 +660,7 @@
j+1, link->lx+1, link->ly+1);
}
#endif
- cube(link->lx, link->ly, j+1) = FALSE;
+ cube(link->lx, link->ly, j+1) = false;
nchanged++;
}
}
@@ -697,7 +697,7 @@
if (isadjacent && (gd == 1)) continue;
if (!isadjacent && (gd != 1)) continue;
- if (cube(nx, ny, n+1) == FALSE)
+ if (cube(nx, ny, n+1) == false)
continue; /* already discounted this possibility. */
#ifdef STANDALONE_SOLVER
@@ -709,7 +709,7 @@
solver_recurse_depth*4, "", n+1, nx+1, ny+1);
}
#endif
- cube(nx, ny, n+1) = FALSE;
+ cube(nx, ny, n+1) = false;
nchanged++;
}
}
@@ -745,7 +745,7 @@
memset(scratch, 0, o*sizeof(int));
for (n = 0; n < o; n++) {
- if (cube(x, y, n+1) == FALSE) continue;
+ if (cube(x, y, n+1) == false) continue;
for (nn = 0; nn < o; nn++) {
if (n == nn) continue;
@@ -762,7 +762,7 @@
* currently set but are not indicated in scratch. */
for (n = 0; n < o; n++) {
if (scratch[n] == 1) continue;
- if (cube(nx, ny, n+1) == FALSE) continue;
+ if (cube(nx, ny, n+1) == false) continue;
#ifdef STANDALONE_SOLVER
if (solver_show_working) {
@@ -773,7 +773,7 @@
solver_recurse_depth*4, "", n+1, nx+1, ny+1);
}
#endif
- cube(nx, ny, n+1) = FALSE;
+ cube(nx, ny, n+1) = false;
nchanged++;
}
}
@@ -1462,7 +1462,7 @@
if (IS_CURSOR_MOVE(button)) {
if (shift_or_control) {
int nx = ui->hx, ny = ui->hy, i, self;
- move_cursor(button, &nx, &ny, ds->order, ds->order, FALSE);
+ move_cursor(button, &nx, &ny, ds->order, ds->order, false);
ui->hshow = ui->hcursor = 1;
for (i = 0; i < 4 && (nx != ui->hx + adjthan[i].dx ||
@@ -1490,7 +1490,7 @@
return dupstr(buf);
} else {
- move_cursor(button, &ui->hx, &ui->hy, ds->order, ds->order, FALSE);
+ move_cursor(button, &ui->hx, &ui->hy, ds->order, ds->order, false);
ui->hshow = ui->hcursor = 1;
return UI_UPDATE;
}
@@ -1553,7 +1553,7 @@
/* real change to grid; check for completion */
if (!ret->completed && check_complete(ret->nums, ret, 1) > 0)
- ret->completed = TRUE;
+ ret->completed = true;
}
return ret;
} else if (move[0] == 'S') {
@@ -1560,7 +1560,7 @@
const char *p;
ret = dup_game(state);
- ret->completed = ret->cheated = TRUE;
+ ret->completed = ret->cheated = true;
p = move+1;
for (i = 0; i < state->order*state->order; i++) {
@@ -1954,7 +1954,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2017,7 +2017,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2024,8 +2024,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2042,9 +2042,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON | REQUIRE_NUMPAD, /* flags */
};
--- a/unfinished/group.c
+++ b/unfinished/group.c
@@ -112,19 +112,19 @@
ret->w = 6;
ret->diff = DIFF_NORMAL;
- ret->id = TRUE;
+ ret->id = true;
return ret;
}
const static struct game_params group_presets[] = {
- { 6, DIFF_NORMAL, TRUE },
- { 6, DIFF_NORMAL, FALSE },
- { 8, DIFF_NORMAL, TRUE },
- { 8, DIFF_NORMAL, FALSE },
- { 8, DIFF_HARD, TRUE },
- { 8, DIFF_HARD, FALSE },
- { 12, DIFF_NORMAL, TRUE },
+ { 6, DIFF_NORMAL, true },
+ { 6, DIFF_NORMAL, false },
+ { 8, DIFF_NORMAL, true },
+ { 8, DIFF_NORMAL, false },
+ { 8, DIFF_HARD, true },
+ { 8, DIFF_HARD, false },
+ { 12, DIFF_NORMAL, true },
};
static bool game_fetch_preset(int i, char **name, game_params **params)
@@ -133,7 +133,7 @@
char buf[80];
if (i < 0 || i >= lenof(group_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = group_presets[i]; /* structure copy */
@@ -143,7 +143,7 @@
*name = dupstr(buf);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -165,7 +165,7 @@
params->w = atoi(p);
while (*p && isdigit((unsigned char)*p)) p++;
params->diff = DIFF_NORMAL;
- params->id = TRUE;
+ params->id = true;
while (*p) {
if (*p == 'd') {
@@ -180,7 +180,7 @@
p++;
}
} else if (*p == 'i') {
- params->id = FALSE;
+ params->id = false;
p++;
} else {
/* unrecognised character */
@@ -866,9 +866,9 @@
desc = spec_to_grid(desc, state->grid, a);
for (i = 0; i < a; i++)
if (state->grid[i] != 0)
- state->immutable[i] = TRUE;
+ state->immutable[i] = true;
- state->completed = state->cheated = FALSE;
+ state->completed = state->cheated = false;
return state;
}
@@ -942,7 +942,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1142,7 +1142,7 @@
{
int w = state->par.w, a = w*w;
digit *grid = state->grid;
- int i, j, k, x, y, errs = FALSE;
+ int i, j, k, x, y, errs = false;
/*
* To verify that we have a valid group table, it suffices to
@@ -1185,7 +1185,7 @@
}
if (mask != (1 << (w+1)) - (1 << 1)) {
- errs = TRUE;
+ errs = true;
errmask &= ~1UL;
if (errors) {
for (x = 0; x < w; x++)
@@ -1204,7 +1204,7 @@
}
if (mask != (1 << (w+1)) - (1 << 1)) {
- errs = TRUE;
+ errs = true;
errmask &= ~1UL;
if (errors) {
for (y = 0; y < w; y++)
@@ -1240,7 +1240,7 @@
errors[right] |= err << EF_RIGHT_SHIFT;
}
}
- errs = TRUE;
+ errs = true;
}
return errs;
@@ -1452,7 +1452,7 @@
if (move[0] == 'S') {
ret = dup_game(from);
- ret->completed = ret->cheated = TRUE;
+ ret->completed = ret->cheated = true;
for (i = 0; i < a; i++) {
if (!ISCHAR(move[i+1]) || FROMCHAR(move[i+1], from->par.id) > w) {
@@ -1502,7 +1502,7 @@
}
if (!ret->completed && !check_errors(ret, NULL))
- ret->completed = TRUE;
+ ret->completed = true;
return ret;
} else if (move[0] == 'M') {
@@ -1621,7 +1621,7 @@
ds->w = w;
ds->par = state->par; /* structure copy */
ds->tilesize = 0;
- ds->started = FALSE;
+ ds->started = false;
ds->tiles = snewn(a, long);
ds->legend = snewn(w, long);
ds->pencil = snewn(a, long);
@@ -1845,7 +1845,7 @@
draw_update(dr, 0, 0, SIZE(w), SIZE(w));
- ds->started = TRUE;
+ ds->started = true;
}
check_errors(state, ds->errtmp);
@@ -1976,8 +1976,8 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
if (state->completed)
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2068,7 +2068,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2075,8 +2075,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2093,9 +2093,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
REQUIRE_RBUTTON | REQUIRE_NUMPAD, /* flags */
};
@@ -2110,15 +2110,15 @@
char *id = NULL, *desc;
const char *err;
digit *grid;
- int grade = FALSE;
- int ret, diff, really_show_working = FALSE;
+ int grade = false;
+ int ret, diff, really_show_working = false;
while (--argc > 0) {
char *p = *++argv;
if (!strcmp(p, "-v")) {
- really_show_working = TRUE;
+ really_show_working = true;
} else if (!strcmp(p, "-g")) {
- grade = TRUE;
+ grade = true;
} else if (*p == '-') {
fprintf(stderr, "%s: unrecognised option `%s'\n", argv[0], p);
return 1;
@@ -2156,7 +2156,7 @@
* the puzzle internally before doing anything else.
*/
ret = -1; /* placate optimiser */
- solver_show_working = FALSE;
+ solver_show_working = false;
for (diff = 0; diff < DIFFCOUNT; diff++) {
memcpy(grid, s->grid, p->w * p->w);
ret = solver(&s->par, grid, diff);
--- a/unfinished/numgame.c
+++ b/unfinished/numgame.c
@@ -182,8 +182,8 @@
int commutes;
/*
- * Function which implements the operator. Returns TRUE on
- * success, FALSE on failure. Takes two rationals and writes
+ * Function which implements the operator. Returns true on
+ * success, false on failure. Takes two rationals and writes
* out a third.
*/
int (*perform)(int *a, int *b, int *output);
@@ -196,13 +196,13 @@
#define MUL(r, a, b) do { \
(r) = (a) * (b); \
- if ((b) && (a) && (r) / (b) != (a)) return FALSE; \
+ if ((b) && (a) && (r) / (b) != (a)) return false; \
} while (0)
#define ADD(r, a, b) do { \
(r) = (a) + (b); \
- if ((a) > 0 && (b) > 0 && (r) < 0) return FALSE; \
- if ((a) < 0 && (b) < 0 && (r) > 0) return FALSE; \
+ if ((a) > 0 && (b) > 0 && (r) < 0) return false; \
+ if ((a) < 0 && (b) < 0 && (r) > 0) return false; \
} while (0)
#define OUT(output, n, d) do { \
@@ -209,8 +209,8 @@
int g = gcd((n),(d)); \
if (g < 0) g = -g; \
if ((d) < 0) g = -g; \
- if (g == -1 && (n) < -INT_MAX) return FALSE; \
- if (g == -1 && (d) < -INT_MAX) return FALSE; \
+ if (g == -1 && (n) < -INT_MAX) return false; \
+ if (g == -1 && (d) < -INT_MAX) return false; \
(output)[0] = (n)/g; \
(output)[1] = (d)/g; \
assert((output)[1] > 0); \
@@ -238,7 +238,7 @@
ADD(tn, at, bt);
MUL(bn, a[1], b[1]);
OUT(output, tn, bn);
- return TRUE;
+ return true;
}
static int perform_sub(int *a, int *b, int *output)
@@ -252,7 +252,7 @@
ADD(tn, at, -bt);
MUL(bn, a[1], b[1]);
OUT(output, tn, bn);
- return TRUE;
+ return true;
}
static int perform_mul(int *a, int *b, int *output)
@@ -264,7 +264,7 @@
MUL(tn, a[0], b[0]);
MUL(bn, a[1], b[1]);
OUT(output, tn, bn);
- return TRUE;
+ return true;
}
static int perform_div(int *a, int *b, int *output)
@@ -275,7 +275,7 @@
* Division by zero is outlawed.
*/
if (b[0] == 0)
- return FALSE;
+ return false;
/*
* a0/a1 / b0/b1 = (a0*b1) / (a1*b0)
@@ -283,7 +283,7 @@
MUL(tn, a[0], b[1]);
MUL(bn, a[1], b[0]);
OUT(output, tn, bn);
- return TRUE;
+ return true;
}
static int perform_exact_div(int *a, int *b, int *output)
@@ -294,7 +294,7 @@
* Division by zero is outlawed.
*/
if (b[0] == 0)
- return FALSE;
+ return false;
/*
* a0/a1 / b0/b1 = (a0*b1) / (a1*b0)
@@ -324,9 +324,9 @@
while (p10 <= (INT_MAX/10) && p10 <= n)
p10 *= 10;
if (p10 > INT_MAX/10)
- return FALSE; /* integer overflow */
+ return false; /* integer overflow */
*p10_r = p10;
- return TRUE;
+ return true;
}
static int perform_concat(int *a, int *b, int *output)
@@ -338,7 +338,7 @@
* integer.
*/
if (a[1] != 1 || b[1] != 1 || a[0] < 0 || b[0] < 0)
- return FALSE;
+ return false;
/*
* For concatenation, we can safely assume leading zeroes
@@ -357,14 +357,14 @@
* _end_ of the 1 first.
*/
if (a[0] == 0)
- return FALSE;
+ return false;
- if (!max_p10(b[0], &p10)) return FALSE;
+ if (!max_p10(b[0], &p10)) return false;
MUL(t1, p10, a[0]);
ADD(t2, t1, b[0]);
OUT(output, t2, 1);
- return TRUE;
+ return true;
}
#define IPOW(ret, x, y) do { \
@@ -400,7 +400,7 @@
IPOW(xn, an, b[1]);
IPOW(xd, ad, b[1]);
if (xn != a[0] || xd != a[1])
- return FALSE;
+ return false;
} else {
an = a[0];
ad = a[1];
@@ -413,10 +413,10 @@
IPOW(xn, ad, -b[0]);
}
if (xd == 0)
- return FALSE;
+ return false;
OUT(output, xn, xd);
- return TRUE;
+ return true;
}
static int perform_factorial(int *a, int *b, int *output)
@@ -427,7 +427,7 @@
* Factorials of non-negative integers are permitted.
*/
if (a[1] != 1 || a[0] < 0)
- return FALSE;
+ return false;
/*
* However, a special case: we don't take a factorial of
@@ -434,7 +434,7 @@
* anything which would thereby remain the same.
*/
if (a[0] == 1 || a[0] == 2)
- return FALSE;
+ return false;
ret = 1;
for (i = 1; i <= a[0]; i++) {
@@ -443,7 +443,7 @@
}
OUT(output, ret, 1);
- return TRUE;
+ return true;
}
static int perform_decimal(int *a, int *b, int *output)
@@ -458,12 +458,12 @@
* x --> x / (smallest power of 10 > than x)
*
*/
- if (a[1] != 1) return FALSE;
+ if (a[1] != 1) return false;
- if (!max_p10(a[0], &p10)) return FALSE;
+ if (!max_p10(a[0], &p10)) return false;
OUT(output, a[0], p10);
- return TRUE;
+ return true;
}
static int perform_recur(int *a, int *b, int *output)
@@ -478,7 +478,7 @@
* returning if no such power of 10 exists. Then multiply the numerator
* up accordingly, and the new denominator becomes that power of 10 - 1.
*/
- if (abs(a[0]) >= abs(a[1])) return FALSE; /* -1 < a < 1 */
+ if (abs(a[0]) >= abs(a[1])) return false; /* -1 < a < 1 */
p10 = 10;
while (p10 <= (INT_MAX/10)) {
@@ -485,13 +485,13 @@
if ((a[1] <= p10) && (p10 % a[1]) == 0) goto found;
p10 *= 10;
}
- return FALSE;
+ return false;
found:
tn = a[0] * (p10 / a[1]);
bn = p10 - 1;
OUT(output, tn, bn);
- return TRUE;
+ return true;
}
static int perform_root(int *a, int *b, int *output)
@@ -504,7 +504,7 @@
if (a[0] == 0) {
OUT(output, 1, 1);
- return TRUE;
+ return true;
}
OUT(ainv, a[1], a[0]);
@@ -514,11 +514,11 @@
static int perform_perc(int *a, int *b, int *output)
{
- if (a[0] == 0) return FALSE; /* 0% = 0, uninteresting. */
- if (a[1] > (INT_MAX/100)) return FALSE;
+ if (a[0] == 0) return false; /* 0% = 0, uninteresting. */
+ if (a[1] > (INT_MAX/100)) return false;
OUT(output, a[0], a[1]*100);
- return TRUE;
+ return true;
}
static int perform_gamma(int *a, int *b, int *output)
@@ -531,7 +531,7 @@
* special case not caught by perform_fact: gamma(1) is 1 so
* don't bother.
*/
- if (a[0] == 1 && a[1] == 1) return FALSE;
+ if (a[0] == 1 && a[1] == 1) return false;
OUT(asub1, a[0]-a[1], a[1]);
return perform_factorial(asub1, b, output);
@@ -544,53 +544,53 @@
/*
* sqrt(0) == 0, sqrt(1) == 1: don't perform unary noops.
*/
- if (a[0] == 0 || (a[0] == 1 && a[1] == 1)) return FALSE;
+ if (a[0] == 0 || (a[0] == 1 && a[1] == 1)) return false;
return perform_exp(a, half, output);
}
const static struct operation op_add = {
- TRUE, "+", "+", 0, 10, 0, TRUE, perform_add
+ true, "+", "+", 0, 10, 0, true, perform_add
};
const static struct operation op_sub = {
- TRUE, "-", "-", 0, 10, 2, FALSE, perform_sub
+ true, "-", "-", 0, 10, 2, false, perform_sub
};
const static struct operation op_mul = {
- TRUE, "*", "*", 0, 20, 0, TRUE, perform_mul
+ true, "*", "*", 0, 20, 0, true, perform_mul
};
const static struct operation op_div = {
- TRUE, "/", "/", 0, 20, 2, FALSE, perform_div
+ true, "/", "/", 0, 20, 2, false, perform_div
};
const static struct operation op_xdiv = {
- TRUE, "/", "/", 0, 20, 2, FALSE, perform_exact_div
+ true, "/", "/", 0, 20, 2, false, perform_exact_div
};
const static struct operation op_concat = {
- FALSE, "", "concat", OPFLAG_NEEDS_CONCAT | OPFLAG_KEEPS_CONCAT,
- 1000, 0, FALSE, perform_concat
+ false, "", "concat", OPFLAG_NEEDS_CONCAT | OPFLAG_KEEPS_CONCAT,
+ 1000, 0, false, perform_concat
};
const static struct operation op_exp = {
- TRUE, "^", "^", 0, 30, 1, FALSE, perform_exp
+ true, "^", "^", 0, 30, 1, false, perform_exp
};
const static struct operation op_factorial = {
- TRUE, "!", "!", OPFLAG_UNARY, 40, 0, FALSE, perform_factorial
+ true, "!", "!", OPFLAG_UNARY, 40, 0, false, perform_factorial
};
const static struct operation op_decimal = {
- TRUE, ".", ".", OPFLAG_UNARY | OPFLAG_UNARYPREFIX | OPFLAG_NEEDS_CONCAT | OPFLAG_KEEPS_CONCAT, 50, 0, FALSE, perform_decimal
+ true, ".", ".", OPFLAG_UNARY | OPFLAG_UNARYPREFIX | OPFLAG_NEEDS_CONCAT | OPFLAG_KEEPS_CONCAT, 50, 0, false, perform_decimal
};
const static struct operation op_recur = {
- TRUE, "...", "recur", OPFLAG_UNARY | OPFLAG_NEEDS_CONCAT, 45, 2, FALSE, perform_recur
+ true, "...", "recur", OPFLAG_UNARY | OPFLAG_NEEDS_CONCAT, 45, 2, false, perform_recur
};
const static struct operation op_root = {
- TRUE, "v~", "root", 0, 30, 1, FALSE, perform_root
+ true, "v~", "root", 0, 30, 1, false, perform_root
};
const static struct operation op_perc = {
- TRUE, "%", "%", OPFLAG_UNARY | OPFLAG_NEEDS_CONCAT, 45, 1, FALSE, perform_perc
+ true, "%", "%", OPFLAG_UNARY | OPFLAG_NEEDS_CONCAT, 45, 1, false, perform_perc
};
const static struct operation op_gamma = {
- TRUE, "gamma", "gamma", OPFLAG_UNARY | OPFLAG_UNARYPREFIX | OPFLAG_FN, 1, 3, FALSE, perform_gamma
+ true, "gamma", "gamma", OPFLAG_UNARY | OPFLAG_UNARYPREFIX | OPFLAG_FN, 1, 3, false, perform_gamma
};
const static struct operation op_sqrt = {
- TRUE, "v~", "sqrt", OPFLAG_UNARY | OPFLAG_UNARYPREFIX, 30, 1, FALSE, perform_sqrt
+ true, "v~", "sqrt", OPFLAG_UNARY | OPFLAG_UNARYPREFIX, 30, 1, false, perform_sqrt
};
/*
@@ -601,7 +601,7 @@
&op_add, &op_mul, &op_sub, &op_xdiv, NULL
};
const static struct rules rules_countdown = {
- ops_countdown, FALSE
+ ops_countdown, false
};
/*
@@ -613,7 +613,7 @@
&op_add, &op_mul, &op_sub, &op_div, NULL
};
const static struct rules rules_3388 = {
- ops_3388, TRUE
+ ops_3388, true
};
/*
@@ -624,7 +624,7 @@
&op_add, &op_mul, &op_sub, &op_div, &op_concat, NULL
};
const static struct rules rules_four4s = {
- ops_four4s, TRUE
+ ops_four4s, true
};
/*
@@ -636,7 +636,7 @@
&op_decimal, &op_recur, &op_root, &op_perc, &op_gamma, &op_sqrt, NULL
};
const static struct rules rules_anythinggoes = {
- ops_anythinggoes, TRUE
+ ops_anythinggoes, true
};
#define ratcmp(a,op,b) ( (long long)(a)[0] * (b)[1] op \
@@ -805,7 +805,7 @@
* Target numbers are always integers.
*/
if (ss->numbers[2*index+1] != 1)
- return FALSE;
+ return false;
ensure(s->outputlists, s->outputlistsize, s->noutputs/OUTPUTLISTLEN+1,
struct output *);
@@ -826,7 +826,7 @@
s->noutputs++;
}
*n = o->number;
- return TRUE;
+ return true;
}
static struct sets *do_search(int ninputs, int *inputs,
@@ -1095,16 +1095,16 @@
*/
int main(int argc, char **argv)
{
- int doing_opts = TRUE;
+ int doing_opts = true;
const struct rules *rules = NULL;
char *pname = argv[0];
- int got_target = FALSE, target = 0;
+ int got_target = false, target = 0;
int numbers[10], nnumbers = 0;
- int verbose = FALSE;
- int pathcounts = FALSE;
- int multiple = FALSE;
- int debug_bfs = FALSE;
- int got_range = FALSE, rangemin = 0, rangemax = 0;
+ int verbose = false;
+ int pathcounts = false;
+ int multiple = false;
+ int debug_bfs = false;
+ int got_range = false, rangemin = 0, rangemax = 0;
struct output *o;
struct sets *s;
@@ -1118,12 +1118,12 @@
p++;
if (!strcmp(p, "-")) {
- doing_opts = FALSE;
+ doing_opts = false;
continue;
} else if (*p == '-') {
p++;
if (!strcmp(p, "debug-bfs")) {
- debug_bfs = TRUE;
+ debug_bfs = true;
} else {
fprintf(stderr, "%s: option '--%s' not recognised\n",
pname, p);
@@ -1142,13 +1142,13 @@
rules = &rules_anythinggoes;
break;
case 'v':
- verbose = TRUE;
+ verbose = true;
break;
case 'p':
- pathcounts = TRUE;
+ pathcounts = true;
break;
case 'm':
- multiple = TRUE;
+ multiple = true;
break;
case 't':
case 'r':
@@ -1166,13 +1166,13 @@
}
switch (c) {
case 't':
- got_target = TRUE;
+ got_target = true;
target = atoi(v);
break;
case 'r':
{
char *sep = strchr(v, '-');
- got_range = TRUE;
+ got_range = true;
if (sep) {
rangemin = atoi(v);
rangemax = atoi(sep+1);
--- a/unfinished/path.c
+++ b/unfinished/path.c
@@ -201,17 +201,17 @@
c = ctx->grid[y*w+x];
if (c < 0)
- return FALSE; /* empty square is not an endpoint! */
+ return false; /* empty square is not an endpoint! */
assert(c >= 0 && c < ctx->npaths);
if (ctx->pathends[c*2] == y*w+x || ctx->pathends[c*2+1] == y*w+x)
- return TRUE;
- return FALSE;
+ return true;
+ return false;
}
/*
* Tries to extend a path by one square in the given direction,
- * pushing other paths around if necessary. Returns TRUE on success
- * or FALSE on failure.
+ * pushing other paths around if necessary. Returns true on success
+ * or false on failure.
*/
static int extend_path(struct genctx *ctx, int path, int end, int direction)
{
@@ -233,7 +233,7 @@
xe = x + DX(direction);
ye = y + DY(direction);
if (xe < 0 || xe >= w || ye < 0 || ye >= h)
- return FALSE; /* could not extend in this direction */
+ return false; /* could not extend in this direction */
/*
* We don't extend paths _directly_ into endpoints of other
@@ -242,13 +242,13 @@
* path's endpoint.
*/
if (is_endpoint(ctx, xe, ye))
- return FALSE;
+ return false;
/*
* We can't extend a path back the way it came.
*/
if (ctx->grid[ye*w+xe] == path)
- return FALSE;
+ return false;
/*
* Paths may not double back on themselves. Check if the new
@@ -262,7 +262,7 @@
if (xf >= 0 && xf < w && yf >= 0 && yf < h &&
(xf != x || yf != y) && ctx->grid[yf*w+xf] == path)
- return FALSE;
+ return false;
}
/*
@@ -331,7 +331,7 @@
ctx->dist, ctx->list);
first = last = -1;
if (ctx->sparegrid3[ctx->pathends[i*2]] != i ||
- ctx->sparegrid3[ctx->pathends[i*2+1]] != i) return FALSE;/* FIXME */
+ ctx->sparegrid3[ctx->pathends[i*2+1]] != i) return false;/* FIXME */
for (j = 0; j < n; j++) {
jp = ctx->list[j];
assert(ctx->dist[jp] == j);
@@ -375,7 +375,7 @@
}
if (first < 0 || last < 0)
- return FALSE; /* path is completely wiped out! */
+ return false; /* path is completely wiped out! */
/*
* Now we've covered sparegrid3 in possible squares for
@@ -393,7 +393,7 @@
* any more. This means the entire push operation
* has failed.
*/
- return FALSE;
+ return false;
}
/*
@@ -407,7 +407,7 @@
if (ctx->sparegrid[jp] >= 0) {
if (ctx->pathspare[ctx->sparegrid[jp]] == 2)
- return FALSE; /* somehow we've hit a fixed path */
+ return false; /* somehow we've hit a fixed path */
ctx->pathspare[ctx->sparegrid[jp]] = 1; /* broken */
}
ctx->sparegrid[jp] = i;
@@ -443,7 +443,7 @@
*/
memcpy(ctx->grid, ctx->sparegrid, w*h*sizeof(int));
memcpy(ctx->pathends, ctx->sparepathends, ctx->npaths*2*sizeof(int));
- return TRUE;
+ return true;
}
/*
@@ -556,10 +556,10 @@
ctx->grid[j] = c;
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*
--- a/unfinished/separate.c
+++ b/unfinished/separate.c
@@ -122,7 +122,7 @@
static bool game_fetch_preset(int i, char **name, game_params **params)
{
- return FALSE;
+ return false;
}
static void free_params(game_params *params)
@@ -337,7 +337,7 @@
int w = sc->w, h = sc->h, k = sc->k;
int wh = w*h;
int i, x, y;
- int done_something_overall = FALSE;
+ int done_something_overall = false;
/*
* Set up the contents array from the grid.
@@ -348,7 +348,7 @@
sc->contents[dsf_canonify(sc->dsf, i)*k+grid[i]] = i;
while (1) {
- int done_something = FALSE;
+ int done_something = false;
/*
* Go over the grid looking for reasons to add to the
@@ -393,7 +393,7 @@
printf("Disconnecting %d and %d (%c)\n", yx, yx2, 'A'+i);
#endif
solver_disconnect(sc, yx, yx2);
- done_something = done_something_overall = TRUE;
+ done_something = done_something_overall = true;
/*
* We have just made a deduction which hinges
@@ -467,7 +467,7 @@
printf("Connecting %d and %d\n", i, sc->tmp[i]);
#endif
solver_connect(sc, i, sc->tmp[i]);
- done_something = done_something_overall = TRUE;
+ done_something = done_something_overall = true;
break;
}
}
@@ -683,7 +683,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -805,7 +805,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -828,7 +828,7 @@
encode_params,
free_params,
dup_params,
- FALSE, game_configure, custom_params,
+ false, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -835,8 +835,8 @@
new_game,
dup_game,
free_game,
- FALSE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ false, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -853,8 +853,8 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/unfinished/slide.c
+++ b/unfinished/slide.c
@@ -174,7 +174,7 @@
char str[80];
if (i < 0 || i >= lenof(slide_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = slide_presets[i];
@@ -187,7 +187,7 @@
*name = dupstr(str);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -481,10 +481,10 @@
*/
for (i = 0; i < wh; i++) {
next[i] = -1;
- anchors[i] = FALSE;
+ anchors[i] = false;
which[i] = -1;
if (ISANCHOR(b->data[i])) {
- anchors[i] = TRUE;
+ anchors[i] = true;
which[i] = i;
} else if (ISDIST(b->data[i])) {
j = i - b->data[i];
@@ -503,7 +503,7 @@
mqhead = mqtail = 0;
for (j = 0; j < wh; j++)
- movereached[j] = FALSE;
+ movereached[j] = false;
movequeue[mqtail++] = i;
while (mqhead < mqtail) {
int pos = movequeue[mqhead++];
@@ -542,7 +542,7 @@
*/
if (movereached[newpos])
continue;
- movereached[newpos] = TRUE;
+ movereached[newpos] = true;
movequeue[mqtail++] = newpos;
/*
@@ -656,7 +656,7 @@
forcefield = snewn(wh, unsigned char);
board2 = snewn(wh, unsigned char);
memset(board, ANCHOR, wh);
- memset(forcefield, FALSE, wh);
+ memset(forcefield, false, wh);
for (i = 0; i < w; i++)
board[i] = board[i+w*(h-1)] = WALL;
for (i = 0; i < h; i++)
@@ -680,7 +680,7 @@
*/
tx = w-2;
ty = h-3;
- forcefield[ty*w+tx+1] = forcefield[(ty+1)*w+tx+1] = TRUE;
+ forcefield[ty*w+tx+1] = forcefield[(ty+1)*w+tx+1] = true;
board[ty*w+tx+1] = board[(ty+1)*w+tx+1] = EMPTY;
/*
@@ -799,7 +799,7 @@
* Didn't work. Revert the merge.
*/
memcpy(board, board2, wh);
- tried_merge[c1 * wh + c2] = tried_merge[c2 * wh + c1] = TRUE;
+ tried_merge[c1 * wh + c2] = tried_merge[c2 * wh + c1] = true;
} else {
int c;
@@ -904,7 +904,7 @@
goto done;
}
link[i] = -1;
- active[i] = FALSE;
+ active[i] = false;
if (*desc == 'f' || *desc == 'F') {
desc++;
if (!*desc) {
@@ -937,8 +937,8 @@
link[i] = i - dist;
- active[i] = TRUE;
- active[link[i]] = FALSE;
+ active[i] = true;
+ active[link[i]] = false;
i++;
} else {
int c = *desc++;
@@ -1016,12 +1016,12 @@
i = 0;
while (*desc && *desc != ',') {
- int f = FALSE;
+ int f = false;
assert(i < wh);
if (*desc == 'f') {
- f = TRUE;
+ f = true;
desc++;
assert(*desc);
}
@@ -1072,7 +1072,7 @@
else
state->completed = -1;
- state->cheated = FALSE;
+ state->cheated = false;
state->soln = NULL;
state->soln_index = -1;
@@ -1166,7 +1166,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1189,7 +1189,7 @@
int w = state->w, h = state->h, wh = w*h;
game_ui *ui = snew(game_ui);
- ui->dragging = FALSE;
+ ui->dragging = false;
ui->drag_anchor = ui->drag_currpos = -1;
ui->drag_offset_x = ui->drag_offset_y = -1;
ui->reachable = snewn(wh, unsigned char);
@@ -1263,7 +1263,7 @@
i -= state->board[i];
assert(i >= 0 && i < wh);
- ui->dragging = TRUE;
+ ui->dragging = true;
ui->drag_anchor = i;
ui->drag_offset_x = tx - (i % w);
ui->drag_offset_y = ty - (i / w);
@@ -1274,9 +1274,9 @@
* the anchor, to find all the places to which this block
* can be dragged.
*/
- memset(ui->reachable, FALSE, wh);
+ memset(ui->reachable, false, wh);
qhead = qtail = 0;
- ui->reachable[i] = TRUE;
+ ui->reachable[i] = true;
ui->bfs_queue[qtail++] = i;
for (j = i; j < wh; j++)
if (state->board[j] == DIST(j - i))
@@ -1334,7 +1334,7 @@
* disqualifying this position, mark it as
* reachable for this drag.
*/
- ui->reachable[newpos] = TRUE;
+ ui->reachable[newpos] = true;
ui->bfs_queue[qtail++] = newpos;
}
}
@@ -1390,7 +1390,7 @@
} else
str = ""; /* null move; just update the UI */
- ui->dragging = FALSE;
+ ui->dragging = false;
ui->drag_anchor = ui->drag_currpos = -1;
ui->drag_offset_x = ui->drag_offset_y = -1;
memset(ui->reachable, 0, wh);
@@ -1422,7 +1422,7 @@
int i, j;
if (!ISANCHOR(dst[from]))
- return FALSE;
+ return false;
/*
* Scan to the far end of the piece's linked list.
@@ -1444,15 +1444,15 @@
for (j = i; j >= 0; j = (ISDIST(src[j]) ? j - src[j] : -1)) {
int jn = j + to - from;
if (jn < 0 || jn >= wh)
- return FALSE;
+ return false;
if (dst[jn] == EMPTY && (!ff[jn] || src[from] == MAINANCHOR)) {
dst[jn] = src[j];
} else {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
static game_state *execute_move(const game_state *state, const char *move)
@@ -1478,7 +1478,7 @@
ret->soln->moves = NULL;
ret->soln->refcount = 1;
ret->soln_index = 0;
- ret->cheated = TRUE;
+ ret->cheated = true;
movesize = 0;
move++;
@@ -1673,7 +1673,7 @@
ds->tilesize = 0;
ds->w = w;
ds->h = h;
- ds->started = FALSE;
+ ds->started = false;
ds->grid = snewn(wh, unsigned long);
for (i = 0; i < wh; i++)
ds->grid[i] = ~(unsigned long)0;
@@ -2130,7 +2130,7 @@
* background-colour rectangle covering the whole window.
*/
draw_rect(dr, 0, 0, 10*ds->tilesize, 10*ds->tilesize, COL_BACKGROUND);
- ds->started = TRUE;
+ ds->started = true;
}
/*
@@ -2297,7 +2297,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -2320,7 +2320,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -2327,8 +2327,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -2345,9 +2345,9 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- TRUE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ true, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
@@ -2360,7 +2360,7 @@
game_params *p;
game_state *s;
char *id = NULL, *desc, *err;
- int count = FALSE;
+ int count = false;
int ret;
int *moves;
@@ -2368,11 +2368,11 @@
char *p = *++argv;
/*
if (!strcmp(p, "-v")) {
- verbose = TRUE;
+ verbose = true;
} else
*/
if (!strcmp(p, "-c")) {
- count = TRUE;
+ count = true;
} else if (*p == '-') {
fprintf(stderr, "%s: unrecognised option `%s'\n", argv[0], p);
return 1;
--- a/unfinished/sokoban.c
+++ b/unfinished/sokoban.c
@@ -169,7 +169,7 @@
char namebuf[80];
if (i < 0 || i >= lenof(sokoban_presets))
- return FALSE;
+ return false;
p = sokoban_presets[i];
ret = dup_params(&p);
@@ -178,7 +178,7 @@
*params = ret;
*name = retname;
- return TRUE;
+ return true;
}
static void decode_params(game_params *params, char const *string)
@@ -741,7 +741,7 @@
* many moves to try?
*/
grid = snewn(w*h, unsigned char);
- sokoban_generate(w, h, grid, w*h, FALSE, rs);
+ sokoban_generate(w, h, grid, w*h, false, rs);
desclen = descpos = descsize = 0;
desc = NULL;
@@ -849,7 +849,7 @@
state->p = *params; /* structure copy */
state->grid = snewn(w*h, unsigned char);
state->px = state->py = -1;
- state->completed = FALSE;
+ state->completed = false;
i = 0;
@@ -906,7 +906,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1158,20 +1158,20 @@
* no free target squares, and no deep pits at all.
*/
if (!ret->completed) {
- freebarrels = FALSE;
- freetargets = FALSE;
+ freebarrels = false;
+ freetargets = false;
for (i = 0; i < w*h; i++) {
int v = ret->grid[i];
if (IS_BARREL(v) && !IS_ON_TARGET(v))
- freebarrels = TRUE;
+ freebarrels = true;
if (v == DEEP_PIT || v == PIT ||
(!IS_BARREL(v) && IS_ON_TARGET(v)))
- freetargets = TRUE;
+ freetargets = true;
}
if (!freebarrels || !freetargets)
- ret->completed = TRUE;
+ ret->completed = true;
}
return ret;
@@ -1261,7 +1261,7 @@
ds->grid = snewn(w*h, unsigned short);
for (i = 0; i < w*h; i++)
ds->grid[i] = INVALID;
- ds->started = FALSE;
+ ds->started = false;
return ds;
}
@@ -1371,7 +1371,7 @@
draw_line(dr, COORD(x), COORD(0), COORD(x), COORD(h),
COL_LOWLIGHT);
- ds->started = TRUE;
+ ds->started = true;
}
/*
@@ -1421,7 +1421,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1444,7 +1444,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1451,8 +1451,8 @@
new_game,
dup_game,
free_game,
- FALSE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ false, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1469,8 +1469,8 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
--- a/unruly.c
+++ b/unruly.c
@@ -52,7 +52,7 @@
#include "puzzles.h"
#ifdef STANDALONE_SOLVER
-int solver_verbose = FALSE;
+int solver_verbose = false;
#endif
enum {
@@ -95,12 +95,12 @@
#define DIFFCONFIG DIFFLIST(CONFIG)
static const struct game_params unruly_presets[] = {
- { 8, 8, FALSE, DIFF_EASY},
- { 8, 8, FALSE, DIFF_NORMAL},
- {10, 10, FALSE, DIFF_EASY},
- {10, 10, FALSE, DIFF_NORMAL},
- {14, 14, FALSE, DIFF_EASY},
- {14, 14, FALSE, DIFF_NORMAL}
+ { 8, 8, false, DIFF_EASY},
+ { 8, 8, false, DIFF_NORMAL},
+ {10, 10, false, DIFF_EASY},
+ {10, 10, false, DIFF_NORMAL},
+ {14, 14, false, DIFF_EASY},
+ {14, 14, false, DIFF_NORMAL}
};
#define DEFAULT_PRESET 0
@@ -157,7 +157,7 @@
char buf[80];
if (i < 0 || i >= lenof(unruly_presets))
- return FALSE;
+ return false;
ret = snew(game_params);
*ret = unruly_presets[i]; /* structure copy */
@@ -166,7 +166,7 @@
*name = dupstr(buf);
*params = ret;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -185,7 +185,7 @@
{
char const *p = string;
- params->unique = FALSE;
+ params->unique = false;
params->w2 = atoi(p);
while (*p && isdigit((unsigned char)*p)) p++;
@@ -199,7 +199,7 @@
if (*p == 'u') {
p++;
- params->unique = TRUE;
+ params->unique = true;
}
if (*p == 'd') {
@@ -356,9 +356,9 @@
state->immutable = snewn(s, unsigned char);
memset(state->grid, EMPTY, s);
- memset(state->immutable, FALSE, s);
+ memset(state->immutable, false, s);
- state->completed = state->cheated = FALSE;
+ state->completed = state->cheated = false;
return state;
}
@@ -379,7 +379,7 @@
pos += (*p - 'a');
if (pos < s) {
state->grid[pos] = N_ZERO;
- state->immutable[pos] = TRUE;
+ state->immutable[pos] = true;
}
pos++;
} else if (*p >= 'A' && *p < 'Z') {
@@ -386,7 +386,7 @@
pos += (*p - 'A');
if (pos < s) {
state->grid[pos] = N_ONE;
- state->immutable[pos] = TRUE;
+ state->immutable[pos] = true;
}
pos++;
} else if (*p == 'Z' || *p == 'z') {
@@ -427,7 +427,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -594,17 +594,17 @@
ret +=
unruly_solver_check_threes(state, scratch->zeros_rows,
- scratch->zeros_cols, TRUE, N_ONE, N_ZERO);
+ scratch->zeros_cols, true, N_ONE, N_ZERO);
ret +=
unruly_solver_check_threes(state, scratch->ones_rows,
- scratch->ones_cols, TRUE, N_ZERO, N_ONE);
+ scratch->ones_cols, true, N_ZERO, N_ONE);
ret +=
unruly_solver_check_threes(state, scratch->zeros_rows,
- scratch->zeros_cols, FALSE, N_ONE,
+ scratch->zeros_cols, false, N_ONE,
N_ZERO);
ret +=
unruly_solver_check_threes(state, scratch->ones_rows,
- scratch->ones_cols, FALSE, N_ZERO, N_ONE);
+ scratch->ones_cols, false, N_ZERO, N_ONE);
return ret;
}
@@ -680,13 +680,13 @@
int ret = 0;
ret += unruly_solver_check_uniques(state, scratch->ones_rows,
- TRUE, N_ONE, N_ZERO, scratch);
+ true, N_ONE, N_ZERO, scratch);
ret += unruly_solver_check_uniques(state, scratch->zeros_rows,
- TRUE, N_ZERO, N_ONE, scratch);
+ true, N_ZERO, N_ONE, scratch);
ret += unruly_solver_check_uniques(state, scratch->ones_cols,
- FALSE, N_ONE, N_ZERO, scratch);
+ false, N_ONE, N_ZERO, scratch);
ret += unruly_solver_check_uniques(state, scratch->zeros_cols,
- FALSE, N_ZERO, N_ONE, scratch);
+ false, N_ZERO, N_ONE, scratch);
return ret;
}
@@ -768,19 +768,19 @@
int ret = 0;
ret +=
- unruly_solver_check_complete_nums(state, scratch->ones_rows, TRUE,
+ unruly_solver_check_complete_nums(state, scratch->ones_rows, true,
scratch->zeros_rows,
scratch->zeros_cols, N_ZERO);
ret +=
- unruly_solver_check_complete_nums(state, scratch->ones_cols, FALSE,
+ unruly_solver_check_complete_nums(state, scratch->ones_cols, false,
scratch->zeros_rows,
scratch->zeros_cols, N_ZERO);
ret +=
- unruly_solver_check_complete_nums(state, scratch->zeros_rows, TRUE,
+ unruly_solver_check_complete_nums(state, scratch->zeros_rows, true,
scratch->ones_rows,
scratch->ones_cols, N_ONE);
ret +=
- unruly_solver_check_complete_nums(state, scratch->zeros_cols, FALSE,
+ unruly_solver_check_complete_nums(state, scratch->zeros_cols, false,
scratch->ones_rows,
scratch->ones_cols, N_ONE);
@@ -928,19 +928,19 @@
int ret = 0;
ret +=
- unruly_solver_check_near_complete(state, scratch->ones_rows, TRUE,
+ unruly_solver_check_near_complete(state, scratch->ones_rows, true,
scratch->zeros_rows,
scratch->zeros_cols, N_ZERO);
ret +=
- unruly_solver_check_near_complete(state, scratch->ones_cols, FALSE,
+ unruly_solver_check_near_complete(state, scratch->ones_cols, false,
scratch->zeros_rows,
scratch->zeros_cols, N_ZERO);
ret +=
- unruly_solver_check_near_complete(state, scratch->zeros_rows, TRUE,
+ unruly_solver_check_near_complete(state, scratch->zeros_rows, true,
scratch->ones_rows,
scratch->ones_cols, N_ONE);
ret +=
- unruly_solver_check_near_complete(state, scratch->zeros_cols, FALSE,
+ unruly_solver_check_near_complete(state, scratch->zeros_cols, false,
scratch->ones_rows,
scratch->ones_cols, N_ONE);
@@ -1011,11 +1011,11 @@
if (nfull != nc)
continue;
for (r2 = r+1; r2 < nr; r2++) {
- int match = TRUE;
+ int match = true;
for (c = 0; c < nc; c++)
if (state->grid[r*rmult + c*cmult] !=
state->grid[r2*rmult + c*cmult])
- match = FALSE;
+ match = false;
if (match) {
if (errors) {
for (c = 0; c < nc; c++) {
@@ -1035,14 +1035,14 @@
{
int errcount = 0;
- errcount += unruly_validate_rows(state, TRUE, N_ONE, errors);
- errcount += unruly_validate_rows(state, FALSE, N_ONE, errors);
- errcount += unruly_validate_rows(state, TRUE, N_ZERO, errors);
- errcount += unruly_validate_rows(state, FALSE, N_ZERO, errors);
+ errcount += unruly_validate_rows(state, true, N_ONE, errors);
+ errcount += unruly_validate_rows(state, false, N_ONE, errors);
+ errcount += unruly_validate_rows(state, true, N_ZERO, errors);
+ errcount += unruly_validate_rows(state, false, N_ZERO, errors);
if (state->unique) {
- errcount += unruly_validate_unique(state, TRUE, errors);
- errcount += unruly_validate_unique(state, FALSE, errors);
+ errcount += unruly_validate_unique(state, true, errors);
+ errcount += unruly_validate_unique(state, false, errors);
}
if (errcount)
@@ -1055,8 +1055,8 @@
{
int w2 = state->w2, h2 = state->h2;
int w = w2/2, h = h2/2;
- char below = FALSE;
- char above = FALSE;
+ char below = false;
+ char above = false;
int i;
/* See if all rows/columns are satisfied. If one is exceeded,
@@ -1063,51 +1063,51 @@
* mark it as an error (if required)
*/
- char hasscratch = TRUE;
+ char hasscratch = true;
if (!scratch) {
scratch = unruly_new_scratch(state);
- hasscratch = FALSE;
+ hasscratch = false;
}
for (i = 0; i < w2; i++) {
if (scratch->ones_cols[i] < h)
- below = TRUE;
+ below = true;
if (scratch->zeros_cols[i] < h)
- below = TRUE;
+ below = true;
if (scratch->ones_cols[i] > h) {
- above = TRUE;
+ above = true;
if (errors)
- errors[2*h2 + i] = TRUE;
+ errors[2*h2 + i] = true;
} else if (errors)
- errors[2*h2 + i] = FALSE;
+ errors[2*h2 + i] = false;
if (scratch->zeros_cols[i] > h) {
- above = TRUE;
+ above = true;
if (errors)
- errors[2*h2 + w2 + i] = TRUE;
+ errors[2*h2 + w2 + i] = true;
} else if (errors)
- errors[2*h2 + w2 + i] = FALSE;
+ errors[2*h2 + w2 + i] = false;
}
for (i = 0; i < h2; i++) {
if (scratch->ones_rows[i] < w)
- below = TRUE;
+ below = true;
if (scratch->zeros_rows[i] < w)
- below = TRUE;
+ below = true;
if (scratch->ones_rows[i] > w) {
- above = TRUE;
+ above = true;
if (errors)
- errors[i] = TRUE;
+ errors[i] = true;
} else if (errors)
- errors[i] = FALSE;
+ errors[i] = false;
if (scratch->zeros_rows[i] > w) {
- above = TRUE;
+ above = true;
if (errors)
- errors[h2 + i] = TRUE;
+ errors[h2 + i] = true;
} else if (errors)
- errors[h2 + i] = FALSE;
+ errors[h2 + i] = false;
}
if (!hasscratch)
@@ -1121,7 +1121,7 @@
{
int done, maxdiff = -1;
- while (TRUE) {
+ while (true) {
done = 0;
/* Check for impending 3's */
@@ -1263,9 +1263,9 @@
if (unruly_validate_all_rows(state, NULL) != 0
|| unruly_validate_counts(state, scratch, NULL) != 0)
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
static char *new_game_desc(const game_params *params, random_state *rs,
@@ -1273,7 +1273,7 @@
{
#ifdef STANDALONE_SOLVER
char *debug;
- int temp_verbose = FALSE;
+ int temp_verbose = false;
#endif
int w2 = params->w2, h2 = params->h2;
@@ -1289,7 +1289,7 @@
while (1) {
- while (TRUE) {
+ while (true) {
attempts++;
state = blank_state(w2, h2, params->unique);
scratch = unruly_new_scratch(state);
@@ -1307,7 +1307,7 @@
sfree(debug);
temp_verbose = solver_verbose;
- solver_verbose = FALSE;
+ solver_verbose = false;
}
#endif
@@ -1348,7 +1348,7 @@
#ifdef STANDALONE_SOLVER
if (temp_verbose) {
- solver_verbose = TRUE;
+ solver_verbose = true;
printf("Final puzzle:\n");
debug = game_text_format(state);
@@ -1428,7 +1428,7 @@
game_ui *ret = snew(game_ui);
ret->cx = ret->cy = 0;
- ret->cursor = FALSE;
+ ret->cursor = false;
return ret;
}
@@ -1474,7 +1474,7 @@
ds->tilesize = 0;
ds->w2 = w2;
ds->h2 = h2;
- ds->started = FALSE;
+ ds->started = false;
ds->gridfs = snewn(s, int);
ds->rowfs = snewn(2 * (w2 + h2), int);
@@ -1518,7 +1518,7 @@
&& oy >= (ds->tilesize / 2) && gy < h2) {
hx = gx;
hy = gy;
- ui->cursor = FALSE;
+ ui->cursor = false;
} else
return NULL;
}
@@ -1526,7 +1526,7 @@
/* Keyboard move */
if (IS_CURSOR_MOVE(button)) {
move_cursor(button, &ui->cx, &ui->cy, w2, h2, 0);
- ui->cursor = TRUE;
+ ui->cursor = true;
return UI_UPDATE;
}
@@ -1595,7 +1595,7 @@
p++;
}
- ret->completed = ret->cheated = TRUE;
+ ret->completed = ret->cheated = true;
return ret;
} else if (move[0] == 'P'
&& sscanf(move + 1, "%c,%d,%d", &c, &x, &y) == 3 && x >= 0
@@ -1613,7 +1613,7 @@
if (!ret->completed && unruly_validate_counts(ret, NULL, NULL) == 0
&& (unruly_validate_all_rows(ret, NULL) == 0))
- ret->completed = TRUE;
+ ret->completed = true;
return ret;
}
@@ -1786,7 +1786,7 @@
TILE_SIZE*h2 + 2*(TILE_SIZE/10) - 1, COL_GRID);
draw_update(dr, 0, 0, TILE_SIZE * (w2+1), TILE_SIZE * (h2+1));
- ds->started = TRUE;
+ ds->started = true;
}
flash = 0;
@@ -1856,7 +1856,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1913,7 +1913,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1920,8 +1920,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- TRUE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ true, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1938,9 +1938,9 @@
game_anim_length,
game_flash_length,
game_status,
- TRUE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ true, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
0, /* flags */
};
@@ -1986,7 +1986,7 @@
seed = (time_t) atoi(*++argv);
argc--;
} else if (!strcmp(p, "-v"))
- solver_verbose = TRUE;
+ solver_verbose = true;
else if (*p == '-')
usage_exit("unrecognised option");
else
@@ -2000,7 +2000,7 @@
params = default_params();
decode_params(params, id);
- err = validate_params(params, TRUE);
+ err = validate_params(params, true);
if (err) {
fprintf(stderr, "Parameters are invalid\n");
fprintf(stderr, "%s: %s", argv[0], err);
@@ -2014,8 +2014,8 @@
if (!params)
params = default_params();
printf("Generating puzzle with parameters %s\n",
- encode_params(params, TRUE));
- desc_gen = new_game_desc(params, rs, &aux, FALSE);
+ encode_params(params, true));
+ desc_gen = new_game_desc(params, rs, &aux, false);
if (!solver_verbose) {
char *fmt = game_text_format(new_game(NULL, params, desc_gen));
--- a/untangle.c
+++ b/untangle.c
@@ -137,7 +137,7 @@
case 2: n = 15; break;
case 3: n = 20; break;
case 4: n = 25; break;
- default: return FALSE;
+ default: return false;
}
sprintf(buf, "%d points", n);
@@ -146,7 +146,7 @@
*params = ret = snew(game_params);
ret->n = n;
- return TRUE;
+ return true;
}
static void free_params(game_params *params)
@@ -331,7 +331,7 @@
/* If they have the same non-zero sign, the lines do not cross. */
if ((sign64(d1) > 0 && sign64(d2) > 0) ||
(sign64(d1) < 0 && sign64(d2) < 0))
- return FALSE;
+ return false;
/*
* If the dot products are both exactly zero, then the two line
@@ -348,13 +348,13 @@
d2 = dotprod64(b2x, px, b2y, py);
/* If they're both strictly negative, the lines do not cross. */
if (sign64(d1) < 0 && sign64(d2) < 0)
- return FALSE;
+ return false;
/* Otherwise, take the dot product of a2-a1 with itself. If
* the other two dot products both exceed this, the lines do
* not cross. */
d3 = dotprod64(px, px, py, py);
if (greater64(d1, d3) && greater64(d2, d3))
- return FALSE;
+ return false;
}
/*
@@ -373,12 +373,12 @@
d2 = dotprod64(b2x, px, b2y, py);
if ((sign64(d1) > 0 && sign64(d2) > 0) ||
(sign64(d1) < 0 && sign64(d2) < 0))
- return FALSE;
+ return false;
/*
* The lines must cross.
*/
- return TRUE;
+ return true;
}
static unsigned long squarert(unsigned long n) {
@@ -540,7 +540,7 @@
edges = newtree234(edgecmp);
vlist = snewn(n, vertex);
while (1) {
- int added = FALSE;
+ int added = false;
for (i = 0; i < n; i++) {
v = index234(vertices, i);
@@ -602,7 +602,7 @@
* the two vertices involved, and break.
*/
addedge(edges, j, ki);
- added = TRUE;
+ added = true;
del234(vertices, vs+j);
vs[j].param++;
add234(vertices, vs+j);
@@ -759,13 +759,13 @@
static void mark_crossings(game_state *state)
{
- int ok = TRUE;
+ int ok = true;
int i, j;
edge *e, *e2;
#ifdef SHOW_CROSSINGS
for (i = 0; (e = index234(state->graph->edges, i)) != NULL; i++)
- state->crosses[i] = FALSE;
+ state->crosses[i] = false;
#endif
/*
@@ -779,9 +779,9 @@
continue;
if (cross(state->pts[e2->a], state->pts[e2->b],
state->pts[e->a], state->pts[e->b])) {
- ok = FALSE;
+ ok = false;
#ifdef SHOW_CROSSINGS
- state->crosses[i] = state->crosses[j] = TRUE;
+ state->crosses[i] = state->crosses[j] = true;
#else
goto done; /* multi-level break - sorry */
#endif
@@ -797,7 +797,7 @@
done:
#endif
if (ok)
- state->completed = TRUE;
+ state->completed = true;
}
static game_state *new_game(midend *me, const game_params *params,
@@ -814,7 +814,7 @@
state->graph = snew(struct graph);
state->graph->refcount = 1;
state->graph->edges = newtree234(edgecmp);
- state->completed = state->cheated = state->just_solved = FALSE;
+ state->completed = state->cheated = state->just_solved = false;
while (*desc) {
a = atoi(desc);
@@ -1025,7 +1025,7 @@
static bool game_can_format_as_text_now(const game_params *params)
{
- return TRUE;
+ return true;
}
static char *game_text_format(const game_state *state)
@@ -1045,7 +1045,7 @@
{
game_ui *ui = snew(game_ui);
ui->dragpoint = -1;
- ui->just_moved = ui->just_dragged = FALSE;
+ ui->just_moved = ui->just_dragged = false;
return ui;
}
@@ -1068,7 +1068,7 @@
{
ui->dragpoint = -1;
ui->just_moved = ui->just_dragged;
- ui->just_dragged = FALSE;
+ ui->just_dragged = false;
}
struct game_drawstate {
@@ -1144,7 +1144,7 @@
*/
sprintf(buf, "P%d:%ld,%ld/%ld", p,
ui->newpoint.x, ui->newpoint.y, ui->newpoint.d);
- ui->just_dragged = TRUE;
+ ui->just_dragged = true;
return dupstr(buf);
}
@@ -1158,13 +1158,13 @@
long x, y, d;
game_state *ret = dup_game(state);
- ret->just_solved = FALSE;
+ ret->just_solved = false;
while (*move) {
if (*move == 'S') {
move++;
if (*move == ';') move++;
- ret->cheated = ret->just_solved = TRUE;
+ ret->cheated = ret->just_solved = true;
}
if (*move == 'P' &&
sscanf(move+1, "%d:%ld,%ld/%ld%n", &p, &x, &y, &d, &k) == 4 &&
@@ -1321,7 +1321,7 @@
* Also in this loop we work out the coordinates of all the
* points for this redraw.
*/
- points_moved = FALSE;
+ points_moved = false;
for (i = 0; i < state->params.n; i++) {
point p = state->pts[i];
long x, y;
@@ -1336,7 +1336,7 @@
y = p.y * ds->tilesize / p.d;
if (ds->x[i] != x || ds->y[i] != y)
- points_moved = TRUE;
+ points_moved = true;
ds->x[i] = x;
ds->y[i] = y;
@@ -1434,7 +1434,7 @@
static bool game_timing_state(const game_state *state, game_ui *ui)
{
- return TRUE;
+ return true;
}
static void game_print_size(const game_params *params, float *x, float *y)
@@ -1457,7 +1457,7 @@
encode_params,
free_params,
dup_params,
- TRUE, game_configure, custom_params,
+ true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
@@ -1464,8 +1464,8 @@
new_game,
dup_game,
free_game,
- TRUE, solve_game,
- FALSE, game_can_format_as_text_now, game_text_format,
+ true, solve_game,
+ false, game_can_format_as_text_now, game_text_format,
new_ui,
free_ui,
encode_ui,
@@ -1482,8 +1482,8 @@
game_anim_length,
game_flash_length,
game_status,
- FALSE, FALSE, game_print_size, game_print,
- FALSE, /* wants_statusbar */
- FALSE, game_timing_state,
+ false, false, game_print_size, game_print,
+ false, /* wants_statusbar */
+ false, game_timing_state,
SOLVE_ANIMATES, /* flags */
};
--- a/windows.c
+++ b/windows.c
@@ -114,7 +114,7 @@
BOOL GetKeyboardState(PBYTE pb)
{
- return FALSE;
+ return false;
}
static TCHAR wClassName[256], wGameName[256];
@@ -656,7 +656,7 @@
SetPixel(fe->hdc, x, y, fe->colours[colour]);
} else {
win_set_brush(fe, colour);
- win_set_pen(fe, colour, TRUE);
+ win_set_pen(fe, colour, true);
p = win_transform_point(fe, x, y);
q = win_transform_point(fe, x+w, y+h);
Rectangle(fe->hdc, p.x, p.y, q.x, q.y);
@@ -673,7 +673,7 @@
if (fe->drawstatus == NOTHING)
return;
- win_set_pen(fe, colour, FALSE);
+ win_set_pen(fe, colour, false);
pp[0] = win_transform_point(fe, x1, y1);
pp[1] = win_transform_point(fe, x2, y2);
Polyline(fe->hdc, pp, 2);
@@ -698,7 +698,7 @@
else
fe->oldbr = SelectObject(fe->hdc, GetStockObject(NULL_BRUSH));
- win_set_pen(fe, outlinecolour, FALSE);
+ win_set_pen(fe, outlinecolour, false);
p = win_transform_point(fe, cx - radius, cy - radius);
q = win_transform_point(fe, cx + radius, cy + radius);
Ellipse(fe->hdc, p.x, p.y, q.x+1, q.y+1);
@@ -727,12 +727,12 @@
if (fillcolour >= 0) {
win_set_brush(fe, fillcolour);
- win_set_pen(fe, outlinecolour, FALSE);
+ win_set_pen(fe, outlinecolour, false);
Polygon(fe->hdc, pts, npoints);
win_reset_brush(fe);
win_reset_pen(fe);
} else {
- win_set_pen(fe, outlinecolour, FALSE);
+ win_set_pen(fe, outlinecolour, false);
Polyline(fe->hdc, pts, npoints+1);
win_reset_pen(fe);
}
@@ -772,7 +772,7 @@
r.bottom = y + h;
OffsetRect(&r, fe->bitmapPosition.left, fe->bitmapPosition.top);
- InvalidateRect(fe->hwnd, &r, FALSE);
+ InvalidateRect(fe->hwnd, &r, false);
}
static void win_end_draw(void *handle)
@@ -900,7 +900,7 @@
fe->printpixelscale = scale;
fe->linewidth = 1;
- fe->linedotted = FALSE;
+ fe->linedotted = false;
}
static void win_end_puzzle(void *handle)
@@ -1222,9 +1222,9 @@
strcpy(r, HELP_CNT_NAME);
if ( (fp = fopen(b, "r")) != NULL) {
fclose(fp);
- help_has_contents = TRUE;
+ help_has_contents = true;
} else
- help_has_contents = FALSE;
+ help_has_contents = false;
return;
}
@@ -1256,7 +1256,7 @@
cmd = HELP_CONTENTS;
}
WinHelp(fe->hwnd, help_path, cmd, (DWORD)str);
- fe->help_running = TRUE;
+ fe->help_running = true;
break;
case CHM:
#ifndef NO_HTMLHELP
@@ -1269,7 +1269,7 @@
str = dupstr(help_path);
}
htmlhelp(fe->hwnd, str, HH_DISPLAY_TOPIC, 0);
- fe->help_running = TRUE;
+ fe->help_running = true;
break;
#endif /* NO_HTMLHELP */
case NONE:
@@ -1300,7 +1300,7 @@
assert(!"This shouldn't happen");
break;
}
- fe->help_running = FALSE;
+ fe->help_running = false;
}
}
@@ -1376,7 +1376,7 @@
* See if we actually got the window size we wanted, and adjust
* the puzzle size if not.
*/
- midend_size(fe->me, &x, &y, TRUE);
+ midend_size(fe->me, &x, &y, true);
if (x != cx || y != cy) {
/*
* Resize the window, now we know what size we _really_
@@ -1385,7 +1385,7 @@
r.left = r.top = 0;
r.right = x;
r.bottom = y + sy;
- AdjustWindowRectEx(&r, WINFLAGS, TRUE, 0);
+ AdjustWindowRectEx(&r, WINFLAGS, true, 0);
*wx = r.right - r.left;
*wy = r.bottom - r.top;
changed = 1;
@@ -1430,7 +1430,7 @@
{
RECT r, sr;
- if (SystemParametersInfo(SPI_GETWORKAREA, 0, &sr, FALSE)) {
+ if (SystemParametersInfo(SPI_GETWORKAREA, 0, &sr, false)) {
*x = sr.right - sr.left;
*y = sr.bottom - sr.top;
r.left = 100;
@@ -1437,7 +1437,7 @@
r.right = 200;
r.top = 100;
r.bottom = 200;
- AdjustWindowRectEx(&r, WINFLAGS, TRUE, 0);
+ AdjustWindowRectEx(&r, WINFLAGS, true, 0);
*x -= r.right - r.left - 100;
*y -= r.bottom - r.top - 100;
} else {
@@ -1485,7 +1485,7 @@
fe->timer = 0;
fe->hwnd = NULL;
- fe->help_running = FALSE;
+ fe->help_running = false;
fe->drawstatus = NOTHING;
fe->dr = NULL;
@@ -1523,7 +1523,7 @@
GetWindowRect(fe->hwnd, &rc);
GetWindowRect(mbi.hwndMB, &rcBar);
rc.bottom -= rcBar.bottom - rcBar.top;
- MoveWindow(fe->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, FALSE);
+ MoveWindow(fe->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, false);
fe->numpad = NULL;
}
@@ -1757,12 +1757,12 @@
fe->statusbar = NULL;
get_max_puzzle_size(fe, &x, &y);
- midend_size(fe->me, &x, &y, FALSE);
+ midend_size(fe->me, &x, &y, false);
r.left = r.top = 0;
r.right = x;
r.bottom = y;
- AdjustWindowRectEx(&r, WINFLAGS, TRUE, 0);
+ AdjustWindowRectEx(&r, WINFLAGS, true, 0);
#ifdef _WIN32_WCE
if (fe->numpad)
@@ -1781,7 +1781,7 @@
rcClient.bottom - (rcTB.bottom - rcTB.top) - 1,
rcClient.right,
rcTB.bottom - rcTB.top,
- FALSE);
+ false);
SendMessage(fe->numpad, TB_SETINDENT, (rcClient.right - (10 * 21)) / 2, 0);
}
else {
@@ -1803,7 +1803,7 @@
fe->hwnd, NULL, fe->inst, NULL);
#ifdef _WIN32_WCE
/* Flat status bar looks better on the Pocket PC */
- SendMessage(fe->statusbar, SB_SIMPLE, (WPARAM) TRUE, 0);
+ SendMessage(fe->statusbar, SB_SIMPLE, (WPARAM) true, 0);
SendMessage(fe->statusbar, SB_SETTEXT,
(WPARAM) 255 | SBT_NOBORDERS,
(LPARAM) L"");
@@ -2013,7 +2013,7 @@
SetDlgItemTextA(hwnd, IDC_ABOUT_VERSION, ver);
}
#endif
- return TRUE;
+ return true;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK)
@@ -2078,18 +2078,18 @@
ret[i].name = "Include currently shown puzzle";
ret[i].type = C_BOOLEAN;
- ret[i].u.boolean.bval = TRUE;
+ ret[i].u.boolean.bval = true;
i++;
ret[i].name = "Print solutions";
ret[i].type = C_BOOLEAN;
- ret[i].u.boolean.bval = FALSE;
+ ret[i].u.boolean.bval = false;
i++;
if (fe->game->can_print_in_colour) {
ret[i].name = "Print in colour";
ret[i].type = C_BOOLEAN;
- ret[i].u.boolean.bval = FALSE;
+ ret[i].u.boolean.bval = false;
i++;
}
@@ -2270,7 +2270,7 @@
create_config_controls(fe);
}
#endif
- return TRUE;
+ return true;
case WM_COMMAND:
/*
@@ -2352,7 +2352,7 @@
ret = CreateWindowEx(exstyle, wclass, wtext,
wstyle | WS_CHILD | WS_VISIBLE, x1, y1, x2-x1, y2-y1,
fe->cfgbox, (HMENU) wid, fe->inst, NULL);
- SendMessage(ret, WM_SETFONT, (WPARAM)fe->cfgfont, MAKELPARAM(TRUE, 0));
+ SendMessage(ret, WM_SETFONT, (WPARAM)fe->cfgfont, MAKELPARAM(true, 0));
return ret;
}
#endif
@@ -2398,11 +2398,11 @@
hdc = GetDC(fe->hwnd);
SetMapMode(hdc, MM_TEXT);
- fe->dlg_done = FALSE;
+ fe->dlg_done = false;
fe->cfgfont = CreateFont(-MulDiv(8, GetDeviceCaps(hdc, LOGPIXELSY), 72),
0, 0, 0, 0,
- FALSE, FALSE, FALSE, DEFAULT_CHARSET,
+ false, false, false, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
FF_SWISS,
@@ -2453,7 +2453,7 @@
DS_MODALFRAME | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU*/) &~
(WS_MAXIMIZEBOX | WS_OVERLAPPED),
- FALSE, 0);
+ false, 0);
/*
* Centre the dialog on its parent window.
@@ -2474,7 +2474,7 @@
fe->hwnd, NULL, fe->inst, NULL);
}
- SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, FALSE);
+ SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, false);
SetWindowLongPtr(fe->cfgbox, GWLP_USERDATA, (LONG_PTR)fe);
SetWindowLongPtr(fe->cfgbox, DWLP_DLGPROC, (LONG_PTR)AboutDlgProc);
@@ -2498,7 +2498,7 @@
SendMessage(fe->cfgbox, WM_INITDIALOG, 0, 0);
- EnableWindow(fe->hwnd, FALSE);
+ EnableWindow(fe->hwnd, false);
ShowWindow(fe->cfgbox, SW_SHOWNORMAL);
while ((gm=GetMessage(&msg, NULL, 0, 0)) > 0) {
if (!IsDialogMessage(fe->cfgbox, &msg))
@@ -2506,7 +2506,7 @@
if (fe->dlg_done)
break;
}
- EnableWindow(fe->hwnd, TRUE);
+ EnableWindow(fe->hwnd, true);
SetForegroundWindow(fe->hwnd);
DestroyWindow(fe->cfgbox);
DeleteObject(fe->cfgfont);
@@ -2552,11 +2552,11 @@
hdc = GetDC(fe->hwnd);
SetMapMode(hdc, MM_TEXT);
- fe->dlg_done = FALSE;
+ fe->dlg_done = false;
fe->cfgfont = CreateFont(-MulDiv(8, GetDeviceCaps(hdc, LOGPIXELSY), 72),
0, 0, 0, 0,
- FALSE, FALSE, FALSE, DEFAULT_CHARSET,
+ false, false, false, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
FF_SWISS,
@@ -2633,7 +2633,7 @@
DS_MODALFRAME | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU*/) &~
(WS_MAXIMIZEBOX | WS_OVERLAPPED),
- FALSE, 0);
+ false, 0);
/*
* Centre the dialog on its parent window.
@@ -2655,7 +2655,7 @@
sfree(title);
}
- SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, FALSE);
+ SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, false);
SetWindowLongPtr(fe->cfgbox, GWLP_USERDATA, (LONG_PTR)fe);
SetWindowLongPtr(fe->cfgbox, DWLP_DLGPROC, (LONG_PTR)ConfigDlgProc);
@@ -2745,7 +2745,7 @@
SendMessage(fe->cfgbox, WM_INITDIALOG, 0, 0);
- EnableWindow(fe->hwnd, FALSE);
+ EnableWindow(fe->hwnd, false);
ShowWindow(fe->cfgbox, SW_SHOWNORMAL);
while ((gm=GetMessage(&msg, NULL, 0, 0)) > 0) {
if (!IsDialogMessage(fe->cfgbox, &msg))
@@ -2753,7 +2753,7 @@
if (fe->dlg_done)
break;
}
- EnableWindow(fe->hwnd, TRUE);
+ EnableWindow(fe->hwnd, true);
SetForegroundWindow(fe->hwnd);
DestroyWindow(fe->cfgbox);
DeleteObject(fe->cfgfont);
@@ -2822,12 +2822,12 @@
int x, y;
get_max_puzzle_size(fe, &x, &y);
- midend_size(fe->me, &x, &y, FALSE);
+ midend_size(fe->me, &x, &y, false);
if (scale != 1.0) {
x = (int)((float)x * fe->puzz_scale);
y = (int)((float)y * fe->puzz_scale);
- midend_size(fe->me, &x, &y, TRUE);
+ midend_size(fe->me, &x, &y, true);
}
fe->ymin = (fe->xmin * y) / x;
@@ -2834,7 +2834,7 @@
r.left = r.top = 0;
r.right = x;
r.bottom = y;
- AdjustWindowRectEx(&r, WINFLAGS, TRUE, 0);
+ AdjustWindowRectEx(&r, WINFLAGS, true, 0);
if (fe->statusbar != NULL) {
GetWindowRect(fe->statusbar, &sr);
@@ -2859,7 +2859,7 @@
new_bitmap(fe, x, y);
#ifdef _WIN32_WCE
- InvalidateRect(fe->hwnd, NULL, TRUE);
+ InvalidateRect(fe->hwnd, NULL, true);
#endif
midend_redraw(fe->me);
}
@@ -2881,7 +2881,7 @@
* difference in size we're asking for. */
GetClientRect(fe->hwnd, &cr);
wr = cr;
- AdjustWindowRectEx(&wr, WINFLAGS, TRUE, 0);
+ AdjustWindowRectEx(&wr, WINFLAGS, true, 0);
xdiff = (proposed->right - proposed->left) - (wr.right - wr.left);
ydiff = (proposed->bottom - proposed->top) - (wr.bottom - wr.top);
@@ -2963,12 +2963,12 @@
BYTE keystate[256];
int r = GetKeyboardState(keystate);
if (!r)
- return FALSE;
+ return false;
if (keystate[VK_MENU] & 0x80)
- return TRUE;
+ return true;
if (keystate[VK_RMENU] & 0x80)
- return TRUE;
- return FALSE;
+ return true;
+ return false;
}
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
@@ -3139,7 +3139,7 @@
"supported by this program";
} else {
me = midend_for_new_game(fe, gamelist[i], NULL,
- FALSE, FALSE, &err_w);
+ false, false, &err_w);
err = err_w;
rewind(fp); /* for the actual load */
}
@@ -3181,7 +3181,7 @@
int p = wParam - IDM_GAMES;
char *error = NULL;
fe_set_midend(fe, midend_for_new_game(fe, gamelist[p], NULL,
- FALSE, FALSE, &error));
+ false, false, &error));
sfree(error);
} else
#endif
@@ -3456,7 +3456,7 @@
} else {
sr->right = sr->left + wx;
}
- return TRUE;
+ return true;
}
break;
#endif
@@ -3475,10 +3475,10 @@
if (hOtherWnd)
{
SetForegroundWindow (hOtherWnd);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
#endif
@@ -3785,7 +3785,7 @@
fe = frontend_new(inst);
me = midend_for_new_game(fe, gg, argc > 0 ? argv[0] : NULL,
- TRUE, TRUE, &error);
+ true, true, &error);
if (!me) {
char buf[128];
#ifdef COMBINED