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.
This commit is contained in:
Simon Tatham
2018-11-13 21:44:02 +00:00
parent 064da87682
commit a550ea0a47
64 changed files with 2111 additions and 2118 deletions

View File

@ -74,7 +74,7 @@ static bool game_fetch_preset(int i, char **name, game_params **params)
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 @@ static bool game_fetch_preset(int i, char **name, game_params **params)
ret->w = w;
ret->h = h;
ret->movetarget = 0;
return TRUE;
return true;
}
static void free_params(game_params *params)
@ -300,7 +300,7 @@ static char *new_game_desc(const game_params *params, random_state *rs,
for (i = 0; i < n; i++) {
tiles[i] = -1;
used[i] = FALSE;
used[i] = false;
}
/*
@ -324,7 +324,7 @@ static char *new_game_desc(const game_params *params, random_state *rs,
break;
assert(j < n && !used[j]);
used[j] = TRUE;
used[j] = true;
while (tiles[x] >= 0)
x++;
@ -408,7 +408,7 @@ static const char *validate_desc(const game_params *params, const char *desc)
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 @@ static const char *validate_desc(const game_params *params, const char *desc)
err = "Number used twice";
goto leave;
}
used[n-1] = TRUE;
used[n-1] = true;
if (*p) p++; /* eat comma */
}
@ -472,7 +472,7 @@ static game_state *new_game(midend *me, const game_params *params,
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 char *solve_game(const game_state *state, const game_state *currstate,
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 @@ static game_ui *new_ui(const game_state *state)
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 @@ static char *interpret_move(const game_state *state, game_ui *ui,
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 @@ static char *interpret_move(const game_state *state, game_ui *ui,
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 @@ static game_state *execute_move(const game_state *from, const char *move)
*/
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 @@ static game_state *execute_move(const game_state *from, const char *move)
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 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state)
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 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
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 int game_status(const game_state *state)
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,15 +1175,15 @@ const struct game thegame = {
encode_params,
free_params,
dup_params,
TRUE, game_configure, custom_params,
true, game_configure, custom_params,
validate_params,
new_game_desc,
validate_desc,
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 @@ const struct game thegame = {
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 */
};