From 46f1cf4143fb0e1980db69b90cad3baa9a84fa6c Mon Sep 17 00:00:00 2001 From: thunic Date: Sun, 17 Mar 2024 13:23:02 +0100 Subject: [PATCH] bool to int --- Minesweeper/Core/Inc/spielfeld.h | 2 +- Minesweeper/Core/Src/spielfeld.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Minesweeper/Core/Inc/spielfeld.h b/Minesweeper/Core/Inc/spielfeld.h index d89fdcd..2d81426 100644 --- a/Minesweeper/Core/Inc/spielfeld.h +++ b/Minesweeper/Core/Inc/spielfeld.h @@ -39,7 +39,7 @@ void revealCell(int** gameBoard, int** hiddenGameBoard, int size, int row, int c void getPositionIndices(int row, int col, Position* pos); void getNewPosition(Position* pos, int dx, int dy, Position* newPos); void setFlag(int** hiddenGameBoard, int row, int col, int* numFlags); -bool checkWin(int** gameBoard, int** hiddenGameBoard, int size, int numBombs, int numFlags); +int checkWin(int** gameBoard, int** hiddenGameBoard, int size, int numBombs, int numFlags); void handleBombExploded(); #endif /* INC_SPIELFELD_H_ */ diff --git a/Minesweeper/Core/Src/spielfeld.c b/Minesweeper/Core/Src/spielfeld.c index a8f78b5..3e30184 100644 --- a/Minesweeper/Core/Src/spielfeld.c +++ b/Minesweeper/Core/Src/spielfeld.c @@ -191,7 +191,7 @@ void revealCell(int** gameBoard, int** hiddenGameBoard, int size, int row, int c return hiddenGameBoard; } if (gameBoard[pos.row][pos.col] == BOMB_CELL) { - handleBombExplode(); + handleBombExploded(); } // Wenn die Zelle leer ist, müssen auch benachbarte leere Zellen aufgedeckt werden @@ -218,12 +218,12 @@ void setFlag(int** hiddenGameBoard, int row, int col, int* numFlags) { } } -bool checkWin(int** gameBoard, int** hiddenGameBoard, int size, int numBombs, int numFlags) { +int checkWin(int** gameBoard, int** hiddenGameBoard, int size, int numBombs, int numFlags) { // Überprüfen, ob alle Bombenpositionen mit einer Flagge markiert wurden for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if (gameBoard[i][j] == BOMB_CELL && hiddenGameBoard[i][j] != FLAG_CELL) { - return false; // Nicht gewonnen, da nicht alle Bomben markiert sind + return 0; // Nicht gewonnen, da nicht alle Bomben markiert sind } } } @@ -249,4 +249,3 @@ void handleBombExploded() { } -}