summaryrefslogtreecommitdiff
path: root/src/Game.cpp
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 /src/Game.cpp
parentd2e8cd4632562675be31b8d2a2de928e2c1ee64b (diff)
Added bombCheck method in Game
Diffstat (limited to 'src/Game.cpp')
-rw-r--r--src/Game.cpp35
1 files changed, 35 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;