mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Adopt C99 bool in the game backend API.
encode_params, validate_params and new_desc now take a bool parameter; fetch_preset, can_format_as_text_now and timing_state all return bool; and the data fields is_timed, wants_statusbar and can_* are all bool. All of those were previously typed as int, but semantically boolean. This commit changes the API declarations in puzzles.h, updates all the games to match (including the unfinisheds), and updates the developer docs as well.
This commit is contained in:
12
bridges.c
12
bridges.c
@ -204,7 +204,7 @@ static void fixup_islands_for_realloc(game_state *state)
|
||||
}
|
||||
}
|
||||
|
||||
static int game_can_format_as_text_now(const game_params *params)
|
||||
static bool game_can_format_as_text_now(const game_params *params)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -648,7 +648,7 @@ static game_params *default_params(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int game_fetch_preset(int i, char **name, game_params **params)
|
||||
static bool game_fetch_preset(int i, char **name, game_params **params)
|
||||
{
|
||||
game_params *ret;
|
||||
char buf[80];
|
||||
@ -716,7 +716,7 @@ static void decode_params(game_params *params, char const *string)
|
||||
}
|
||||
}
|
||||
|
||||
static char *encode_params(const game_params *params, int full)
|
||||
static char *encode_params(const game_params *params, bool full)
|
||||
{
|
||||
char buf[80];
|
||||
|
||||
@ -795,7 +795,7 @@ static game_params *custom_params(const config_item *cfg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const char *validate_params(const game_params *params, int full)
|
||||
static const char *validate_params(const game_params *params, bool full)
|
||||
{
|
||||
if (params->w < 3 || params->h < 3)
|
||||
return "Width and height must be at least 3";
|
||||
@ -1820,7 +1820,7 @@ static void free_game(game_state *state)
|
||||
#define ORDER(a,b) do { if (a < b) { int tmp=a; int a=b; int b=tmp; } } while(0)
|
||||
|
||||
static char *new_game_desc(const game_params *params, random_state *rs,
|
||||
char **aux, int interactive)
|
||||
char **aux, bool interactive)
|
||||
{
|
||||
game_state *tobuild = NULL;
|
||||
int i, j, wh = params->w * params->h, x, y, dx, dy;
|
||||
@ -3145,7 +3145,7 @@ static int game_status(const game_state *state)
|
||||
return state->completed ? +1 : 0;
|
||||
}
|
||||
|
||||
static int game_timing_state(const game_state *state, game_ui *ui)
|
||||
static bool game_timing_state(const game_state *state, game_ui *ui)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user