diff --git a/src/main/c/Minesweeper/minesweeper_start.c b/src/main/c/Minesweeper/minesweeper_start.c index 98eb0eb..48bf4d9 100644 --- a/src/main/c/Minesweeper/minesweeper_start.c +++ b/src/main/c/Minesweeper/minesweeper_start.c @@ -88,7 +88,12 @@ void game_minesweeper(){ getchar(); if(x < board.width && x > -1 && y < board.height && y > -1){ x = x + y * board.width; - if(t == 0){running = open_tile(&board, x);} + if(t == 0){ + int bombs = open_tile(&board, x); + if(bombs == -1){running = false;} + else if(bombs == 0){board.tiles[x] = EMPTY;} + else{board.tiles[x] = bombs + 48;} + } if(t == 1){board.tiles[x] = board.tiles[x] == FLAG ? BLOCK : board.tiles[x] == BLOCK ? FLAG : board.tiles[x];} } if (t == 2){break;} @@ -201,7 +206,7 @@ void draw_minesweeper(Minesweeper_Board board){ int open_tile(Minesweeper_Board *board, int tile){ if(bomb_in_array(board->bombs, tile, board->num_bombs)){return -1;} int num = number_of_bombs(board, tile); - + if(1){return num;} } int number_of_bombs(Minesweeper_Board *board, int tile){