From 586c152da48cc339eeb1b324f1abbd50e86a3d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophyl=20Hoguet?= Date: Tue, 11 Jan 2022 23:03:04 +0100 Subject: [PATCH] fixed --- game.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/game.c b/game.c index 7e29bec..d68a5f9 100644 --- a/game.c +++ b/game.c @@ -198,7 +198,8 @@ void game_update_flags(game g) { if (/* test if both tab are not 0*/ tab[y] != tab[y + 1] && (/* normal check */ (j + x * tab[y + 1] >= 0 && j + x * tab[y + 1] < g->width && i + x * tab[y] >= 0 && i + x * tab[y] < g->height) || - /* wrapping check*/ (g->wrapping && (((i + g->height + x * tab[y]) != i) && ((j + g->width + x * tab[y + 1]) % g->width) != j)))) { + /* wrapping check*/ ( + g->wrapping && !((((i + g->height + x * tab[y]) % g->height) == i) && (((j + g->width + x * tab[y + 1]) % g->width) == j))))) { if (game_is_black(g, ((i + g->height + x * tab[y]) % g->height), ((j + g->width + x * tab[y + 1]) % g->width))) { tab[y] = 0; tab[y + 1] = 0; @@ -224,7 +225,8 @@ void game_update_flags(game g) { int tab[] = {-1, 0, 1, 0, 0, -1, 0, 1}; for (uint y = 0; y < 7; y = y + 2) { if (/* normal check*/ (j + tab[y + 1] >= 0 && j + tab[y + 1] < g->width && i + tab[y] >= 0 && i + tab[y] < g->height) || - /*wrapping check*/ (g->wrapping && (((i + g->height + 1 * tab[y]) != i) && ((j + g->width + 1 * tab[y + 1]) % g->width) != j))) { + /*wrapping check*/ (g->wrapping && + !((((i + g->height + tab[y]) % g->height) == i) && (((j + g->width + tab[y + 1]) % g->width) == j)))) { if (game_is_lightbulb(g, (i + g->height + tab[y]) % g->height, (j + g->width + tab[y + 1]) % g->width)) lb++; else if (!game_is_blank(g, (i + g->height + tab[y]) % g->height, (j + g->width + tab[y + 1]) % g->width) ||