From 59455f0d662a161491b9a7b1553e2d580ec27241 Mon Sep 17 00:00:00 2001 From: Nathan Nunes Date: Wed, 1 Dec 2021 17:47:13 +0100 Subject: [PATCH] commit last functions --- README.md | 6 +++--- game.c | 14 +++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fc98f24..8573cbd 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ Projet Techno | [game_is_lightbulb](./game.c#L?) | [bool game_is_lightbulb(cgame g, uint i, uint j)](./game.h#L180-190) | @thperrier | | | | [game_is_black](./game.c#L98-102) | [bool game_is_black(cgame g, uint i, uint j)](./game.h#L192-202) | @thoguet | | | | [game_get_black_number](./game.c#L104-108) | [int game_get_black_number(cgame g, uint i, uint j)](./game.h#L204-214) | @thoguet | | | -| [game_is_marked](./game.c#L?) | [bool game_is_marked(cgame g, uint i, uint j)](./game.h#L216-226) | @nnunes | | | -| [game_is_lighted](./game.c#L?) | [bool game_is_lighted(cgame g, uint i, uint j)](./game.h#L228-238) | @nnunes | | | -| [game_has_error](./game.c#L?) | [bool game_has_error(cgame g, uint i, uint j)](./game.h#L240-252) | @nnunes | | | +| [game_is_marked](./game.c#L?) | [bool game_is_marked(cgame g, uint i, uint j)](./game.h#L216-226) | @nnunes | | | +| [game_is_lighted](./game.c#L?) | [bool game_is_lighted(cgame g, uint i, uint j)](./game.h#L228-238) | @nnunes | | | +| [game_has_error](./game.c#L?) | [bool game_has_error(cgame g, uint i, uint j)](./game.h#L240-252) | @nnunes | | | | [game_check_move](./game.c#L122-128) | [bool game_check_move(cgame g, uint i, uint j, square s)](./game.h#L242-269) | @thoguet | | | | [game_play_move](./game.c#L130-133) | [void game_play_move(game g, uint i, uint j, square s)](./game.h#L271-284) | @thoguet | | | | [game_update_flags](./game.c#L135-234) | [void game_update_flags(game g)](./game.h#L145-406) | @thoguet | | | diff --git a/game.c b/game.c index 412a0f1..d22ca4e 100644 --- a/game.c +++ b/game.c @@ -128,14 +128,26 @@ int game_get_black_number(cgame g, uint i, uint j) { } bool game_is_marked(cgame g, uint i, uint j) { - return false; + return ((g->tab_cell[i][j] == S_MARK) || + (g->tab_cell[i][j] == (S_MARK | F_LIGHTED)) || + (g->tab_cell[i][j] == (S_MARK | F_ERROR)) || + (g->tab_cell[i][j] == (S_MARK | F_LIGHTED | F_ERROR))); } bool game_is_lighted(cgame g, uint i, uint j) { + if (g->tab_cell[i][j] >= F_ERROR) { + g->tab_cell[i][j] -= F_ERROR; + } + if (g->tab_cell[i][j] >= F_LIGHTED) { + return true; + } return false; } bool game_has_error(cgame g, uint i, uint j) { + if (g->tab_cell[i][j] >= F_ERROR) { + return true; + } return false; }