bool to int

master
thunic 2 years ago
parent c722f18aa8
commit 46f1cf4143

@ -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_ */

@ -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() {
}
}

Loading…
Cancel
Save