summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordawidg81 <dawidgorski.m@gmail.com>2026-02-03 10:40:49 +0100
committerdawidg81 <dawidgorski.m@gmail.com>2026-02-03 10:40:49 +0100
commit5f871f7a4c95201764b1d6725ad338b04b8040cf (patch)
tree2193e82dd31b1ae1cec0ea432787412885167042
parentd2e8cd4632562675be31b8d2a2de928e2c1ee64b (diff)
Added bombCheck method in Game
-rw-r--r--src/Game.cpp35
-rw-r--r--src/Game.hpp1
2 files changed, 36 insertions, 0 deletions
diff --git a/src/Game.cpp b/src/Game.cpp
index a703913..82c5eb7 100644
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -147,6 +147,41 @@ void Game::displayBoard() {
}
}
+void Game::bombCheck(){
+ for(int x=0; x < boardWidth; x++){
+ for(int y=0; y < boardHeight; y++){
+ if(tileMap[x][y] == 1){
+ int bombsAround[boardWidth][boardHeight];
+
+ if(bombMap[x-1][y-1] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x][y-1] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x+1][y-1] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x-1][y] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x+1][y] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x-1][y+1] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x][y+1] == true){
+ bombsAround[x][y]++;
+ }
+ if(bombMap[x+1][y+1] == true){
+ bombsAround[x][y]++;
+ }
+ }
+ }
+ }
+}
+
void Game::input(){
std::string input;
diff --git a/src/Game.hpp b/src/Game.hpp
index 61a788e..e828780 100644
--- a/src/Game.hpp
+++ b/src/Game.hpp
@@ -20,6 +20,7 @@ public:
void initDiff(int diff);
void initBoard();
void displayBoard();
+ void bombCheck();
void input();
};