Use C99 bool within source modules.

This is the main bulk of this boolification work, but although it's
making the largest actual change, it should also be the least
disruptive to anyone interacting with this code base downstream of me,
because it doesn't modify any interface between modules: all the
inter-module APIs were updated one by one in the previous commits.
This just cleans up the code within each individual source file to use
bool in place of int where I think that makes things clearer.
This commit is contained in:
Simon Tatham
2018-11-13 21:45:44 +00:00
parent a550ea0a47
commit 5f5b284c0b
61 changed files with 2297 additions and 1973 deletions

View File

@ -131,7 +131,7 @@ struct game_state {
game_params p;
unsigned char *grid;
int px, py;
int completed;
bool completed;
};
static game_params *default_params(void)
@ -300,7 +300,7 @@ static const char *validate_params(const game_params *params, bool full)
*/
static void sokoban_generate(int w, int h, unsigned char *grid, int moves,
int nethack, random_state *rs)
bool nethack, random_state *rs)
{
struct pull {
int ox, oy, nx, ny, score;
@ -940,7 +940,7 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate,
struct game_drawstate {
game_params p;
int tilesize;
int started;
bool started;
unsigned short *grid;
};
@ -1099,7 +1099,8 @@ static game_state *execute_move(const game_state *state, const char *move)
{
int w = state->p.w, h = state->p.h;
int px = state->px, py = state->py;
int dx, dy, nx, ny, nbx, nby, type, m, i, freebarrels, freetargets;
int dx, dy, nx, ny, nbx, nby, type, m, i;
bool freebarrels, freetargets;
game_state *ret;
if (*move < '1' || *move == '5' || *move > '9' || move[1])