summaryrefslogtreecommitdiff
path: root/src/Game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Game.cpp')
-rw-r--r--src/Game.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/Game.cpp b/src/Game.cpp
index 82c5eb7..8b59365 100644
--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -54,8 +54,18 @@ void Game::initBoard(){
tileMap[i][j] = 0;
// DEBUG: seeing bombs
- if(bombMap[i][j] == true){
- tileMap[i][j] = 11;
+ // if(bombMap[i][j] == true){
+ // tileMap[i][j] = 11;
+ // }
+ }
+ }
+}
+
+void Game::updateBoard(){
+ for(int x=0; x < boardWidth; x++){
+ for(int y=0; y < boardHeight; y++){
+ if(Game::bombCheck() == 0){
+ tileMap[x][y] = 1;
}
}
}
@@ -147,12 +157,12 @@ void Game::displayBoard() {
}
}
-void Game::bombCheck(){
+int Game::bombCheck(){
+ int bombsAround[boardWidth][boardHeight];
+
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]++;
}
@@ -177,6 +187,7 @@ void Game::bombCheck(){
if(bombMap[x+1][y+1] == true){
bombsAround[x][y]++;
}
+ return bombsAround[x][y];
}
}
}