mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -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:
60
untangle.c
60
untangle.c
@ -137,7 +137,7 @@ static bool game_fetch_preset(int i, char **name, game_params **params)
|
||||
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 @@ static bool game_fetch_preset(int i, char **name, game_params **params)
|
||||
*params = ret = snew(game_params);
|
||||
ret->n = n;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void free_params(game_params *params)
|
||||
@ -331,7 +331,7 @@ static int cross(point a1, point a2, point b1, point b2)
|
||||
/* 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 @@ static int cross(point a1, point a2, point b1, point b2)
|
||||
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 @@ static int cross(point a1, point a2, point b1, point b2)
|
||||
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 @@ static char *new_game_desc(const game_params *params, random_state *rs,
|
||||
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 @@ static char *new_game_desc(const game_params *params, random_state *rs,
|
||||
* 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 const char *validate_desc(const game_params *params, const char *desc)
|
||||
|
||||
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 @@ static void mark_crossings(game_state *state)
|
||||
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 @@ static void mark_crossings(game_state *state)
|
||||
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 @@ static game_state *new_game(midend *me, const game_params *params,
|
||||
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 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)
|
||||
@ -1045,7 +1045,7 @@ static game_ui *new_ui(const game_state *state)
|
||||
{
|
||||
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 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate,
|
||||
{
|
||||
ui->dragpoint = -1;
|
||||
ui->just_moved = ui->just_dragged;
|
||||
ui->just_dragged = FALSE;
|
||||
ui->just_dragged = false;
|
||||
}
|
||||
|
||||
struct game_drawstate {
|
||||
@ -1144,7 +1144,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
|
||||
*/
|
||||
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 @@ static game_state *execute_move(const game_state *state, const char *move)
|
||||
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 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
|
||||
* 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 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
|
||||
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 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)
|
||||
@ -1457,15 +1457,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,
|
||||
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 @@ const struct game thegame = {
|
||||
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 */
|
||||
};
|
||||
|
Reference in New Issue
Block a user