diff options
| author | Simon Tatham <anakin@pobox.com> | 2018-11-13 21:44:02 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2018-11-13 21:48:24 +0000 |
| commit | a550ea0a47374705a37f36b0f05ffe9e4c8161fb (patch) | |
| tree | a4664ac4d90cdeb581ddd2bf41ccda7b0d45855c /towers.c | |
| parent | 064da876828ea3079d5d7be5849b693f4d55364b (diff) | |
| download | puzzles-a550ea0a47374705a37f36b0f05ffe9e4c8161fb.zip puzzles-a550ea0a47374705a37f36b0f05ffe9e4c8161fb.tar.gz puzzles-a550ea0a47374705a37f36b0f05ffe9e4c8161fb.tar.bz2 puzzles-a550ea0a47374705a37f36b0f05ffe9e4c8161fb.tar.xz | |
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.
Diffstat (limited to 'towers.c')
| -rw-r--r-- | towers.c | 64 |
1 files changed, 32 insertions, 32 deletions
@@ -146,7 +146,7 @@ static bool game_fetch_preset(int i, char **name, game_params **params) 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 @@ static bool game_fetch_preset(int i, char **name, game_params **params) *name = dupstr(buf); *params = ret; - return TRUE; + return true; } static void free_params(game_params *params) @@ -268,7 +268,7 @@ static int solver_easy(struct latin_solver *solver, void *vctx) #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 @@ static int solver(int w, int *clues, digit *soln, int maxdiff) 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 @@ static game_state *new_game(midend *me, const game_params *params, } assert(!*p); - state->completed = state->cheated = FALSE; + state->completed = state->cheated = false; return state; } @@ -1021,7 +1021,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) @@ -1199,7 +1199,7 @@ static int check_errors(const game_state *state, int *errors) 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 @@ static int check_errors(const game_state *state, int *errors) } 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 @@ static int check_errors(const game_state *state, int *errors) } 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 @@ static int check_errors(const game_state *state, int *errors) 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 @@ static int is_clue(const game_state *state, int x, int y) ((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 @@ static game_state *execute_move(const game_state *from, const char *move) 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 @@ static game_state *execute_move(const game_state *from, const char *move) 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 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) 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 @@ static void game_redraw(drawing *dr, game_drawstate *ds, 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 int game_status(const game_state *state) 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,15 +1999,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, @@ -2024,9 +2024,9 @@ const struct game thegame = { 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 @@ int main(int argc, char **argv) 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 @@ int main(int argc, char **argv) * 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); |