mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
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:
50
fifteen.c
50
fifteen.c
@ -65,9 +65,9 @@ static bool game_fetch_preset(int i, char **name, game_params **params)
|
||||
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 @@ 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;
|
||||
}
|
||||
|
||||
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 @@ 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++;
|
||||
@ -283,7 +283,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;
|
||||
@ -312,7 +312,7 @@ static const char *validate_desc(const game_params *params, const char *desc)
|
||||
err = "Number used twice";
|
||||
goto leave;
|
||||
}
|
||||
used[n] = TRUE;
|
||||
used[n] = true;
|
||||
|
||||
if (*p) p++; /* eat comma */
|
||||
}
|
||||
@ -350,7 +350,7 @@ static game_state *new_game(midend *me, const game_params *params,
|
||||
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 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)
|
||||
@ -657,7 +657,7 @@ static int compute_hint(const game_state *state, int *out_x, int *out_y)
|
||||
}
|
||||
|
||||
if (next_piece == n)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
/* 2, 3. Move the next piece towards its place */
|
||||
|
||||
@ -680,7 +680,7 @@ static int compute_hint(const game_state *state, int *out_x, int *out_y)
|
||||
|
||||
*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 @@ static char *interpret_move(const game_state *state, game_ui *ui,
|
||||
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 @@ 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->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 @@ 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;
|
||||
@ -929,7 +929,7 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
|
||||
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 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)
|
||||
@ -1090,15 +1090,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,
|
||||
@ -1115,9 +1115,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 */
|
||||
};
|
||||
|
||||
@ -1129,7 +1129,7 @@ int main(int argc, char **argv)
|
||||
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 @@ int main(int argc, char **argv)
|
||||
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;
|
||||
|
Reference in New Issue
Block a user