summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.Game.cpp.swpbin16384 -> 0 bytes
-rw-r--r--src/Game.cpp21
-rw-r--r--src/Game.hpp3
3 files changed, 18 insertions, 6 deletions
diff --git a/src/.Game.cpp.swp b/src/.Game.cpp.swp
deleted file mode 100644
index d32da3a..0000000
--- a/src/.Game.cpp.swp
+++ /dev/null
Binary files differ
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];
}
}
}
diff --git a/src/Game.hpp b/src/Game.hpp
index e828780..88fc36b 100644
--- a/src/Game.hpp
+++ b/src/Game.hpp
@@ -19,8 +19,9 @@ public:
int editDiff();
void initDiff(int diff);
void initBoard();
+ void updateBoard();
void displayBoard();
- void bombCheck();
+ int bombCheck();
void input();
};