aboutsummaryrefslogtreecommitdiff
path: root/flood.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2018-11-13 21:45:44 +0000
committerSimon Tatham <anakin@pobox.com>2018-11-13 21:48:24 +0000
commit5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a (patch)
treef96b55a27088ae71d74dc83d7cc3731c5d5bf6dc /flood.c
parenta550ea0a47374705a37f36b0f05ffe9e4c8161fb (diff)
downloadpuzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.zip
puzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.tar.gz
puzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.tar.bz2
puzzles-5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a.tar.xz
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.
Diffstat (limited to 'flood.c')
-rw-r--r--flood.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/flood.c b/flood.c
index 56d1d96..cb1ef28 100644
--- a/flood.c
+++ b/flood.c
@@ -63,9 +63,9 @@ typedef struct soln {
struct game_state {
int w, h, colours;
int moves, movelimit;
- int complete;
+ bool complete;
char *grid;
- int cheated;
+ bool cheated;
int solnpos;
soln *soln;
};
@@ -441,7 +441,7 @@ static void fill(int w, int h, char *grid, int x0, int y0, char newcolour,
/*
* Detect a completed grid.
*/
-static int completed(int w, int h, char *grid)
+static bool completed(int w, int h, char *grid)
{
int wh = w*h;
int i;
@@ -760,7 +760,7 @@ static char *game_text_format(const game_state *state)
}
struct game_ui {
- int cursor_visible;
+ bool cursor_visible;
int cx, cy;
enum { VICTORY, DEFEAT } flash_type;
};
@@ -794,7 +794,7 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate,
}
struct game_drawstate {
- int started;
+ bool started;
int tilesize;
int *grid;
};
@@ -1158,7 +1158,7 @@ static void game_redraw(drawing *dr, game_drawstate *ds,
TILESIZE * w + 2 * SEP_WIDTH, TILESIZE * h + 2 * SEP_WIDTH,
COL_SEPARATOR);
- ds->started = 1;
+ ds->started = true;
}
if (flashtime > 0) {