bug fix game_has_error
This commit is contained in:
1 parent
73b327e41a
commit
e5a330f56a
2 files changed
+7
-6
No files matched your search
@@ -91,14 +91,15 @@ square game_get_state(cgame g, uint i, uint j) {
|
||||
}
|
||||
|
||||
square game_get_flags(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) {
|
||||
square temp = g->tab_cell[i][j];
|
||||
if (temp >= F_ERROR) {
|
||||
temp -= F_ERROR;
|
||||
if (temp >= F_LIGHTED) {
|
||||
return (F_ERROR | F_LIGHTED);
|
||||
}
|
||||
return (F_ERROR);
|
||||
}
|
||||
if (g->tab_cell[i][j] >= F_LIGHTED) {
|
||||
if (temp >= F_LIGHTED) {
|
||||
return (F_LIGHTED);
|
||||
}
|
||||
return (S_BLANK);
|
||||
|
||||
+2
-2
@@ -344,12 +344,12 @@ bool test_game_is_lighted(void) {
|
||||
/* ************** game_has_error ************** */
|
||||
bool test_game_has_error(void) {
|
||||
game g = game_new_empty();
|
||||
game_set_square(g, 0, 0, S_BLANK | F_ERROR);
|
||||
game_set_square(g, 0, 0, S_LIGHTBULB | F_ERROR);
|
||||
if ((game_get_flags(g, 0, 0) == F_ERROR) && game_has_error(g, 0, 0)) {
|
||||
game_delete(g);
|
||||
return true;
|
||||
}
|
||||
game_set_square(g, 0, 0, S_BLANK | F_LIGHTED | F_ERROR);
|
||||
game_set_square(g, 0, 0, S_LIGHTBULB | F_LIGHTED | F_ERROR);
|
||||
if ((game_get_flags(g, 0, 0) == (F_LIGHTED | F_ERROR)) &&
|
||||
game_has_error(g, 0, 0)) {
|
||||
game_delete(g);
|
||||
|
||||
Reference in new issue
Block a user