diff options
Diffstat (limited to 'mpi/src')
-rw-r--r-- | mpi/src/game.c | 2 | ||||
-rw-r--r-- | mpi/src/main.c | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/mpi/src/game.c b/mpi/src/game.c index de73f67..8f464a0 100644 --- a/mpi/src/game.c +++ b/mpi/src/game.c @@ -5,7 +5,7 @@ int neighbors(struct GAME* game, int x, int y, unsigned char* halo_above, unsign for (int dy = -1; dy <= 1; dy++) { for (int dx = -1; dx <= 1; dx++) { - if (!(dx == 0 && dy == 0) && (x+dx) > 0 && (x+dx) < game->width+(game->padding*2)) { + if (!(dx == 0 && dy == 0) && (x+dx) > 0 && (x+dx) < game->width+(game->padding*2) && (y+dy) < game->height) { if (y+dy == -1 && halo_above != NULL) { if (halo_above[x+dx]) { n++; diff --git a/mpi/src/main.c b/mpi/src/main.c index 02e2bb6..ea6c4d7 100644 --- a/mpi/src/main.c +++ b/mpi/src/main.c @@ -3,6 +3,7 @@ #include <stdio.h> #include <string.h> #include <mpi.h> +#include <stddef.h> #include "file.h" #include "game.h" |