diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Game.cpp (renamed from src/Game/Game.cpp) | 25 | ||||
| -rw-r--r-- | src/Game.hpp (renamed from src/Game/Game.hpp) | 0 | ||||
| -rw-r--r-- | src/Game/display.cpp | 14 | ||||
| -rw-r--r-- | src/Game/edit.cpp | 25 | ||||
| -rw-r--r-- | src/Game/init.cpp | 38 | ||||
| -rw-r--r-- | src/Utils.cpp (renamed from src/Utils/catch.cpp) | 0 | ||||
| -rw-r--r-- | src/Utils.hpp (renamed from src/Utils/Utils.hpp) | 0 |
7 files changed, 25 insertions, 77 deletions
diff --git a/src/Game/Game.cpp b/src/Game.cpp index b0f6a80..7c7e2d3 100644 --- a/src/Game/Game.cpp +++ b/src/Game.cpp @@ -43,3 +43,28 @@ void Game::initBoard() { } } +int Game::editDiff(){ + Utils util; + + std::cout << "Now editing custom difficulty" << std::endl; + + std::cout << "Board width: "; + if(util.catchReturn(util.catchInputInt(Game::boardWidth)) != 0) return 1; + std::cout << Game::boardWidth; + + std::cout << "Board height: "; + if(util.catchReturn(util.catchInputInt(Game::boardHeight)) != 0) return 1; + + std::cout << "Mines: "; + if(util.catchReturn(util.catchInputInt(Game::mines)) != 0) return 1; + + return 0; +} + +void Game::displayBoard() { + for (int i = 0; i < boardHeight; i++) { + for (int j = 0; j < boardWidth; j++) + putchar(tileMap[i][j]); + putchar('\n'); + } +}
\ No newline at end of file diff --git a/src/Game/Game.hpp b/src/Game.hpp index 767ab94..767ab94 100644 --- a/src/Game/Game.hpp +++ b/src/Game.hpp diff --git a/src/Game/display.cpp b/src/Game/display.cpp deleted file mode 100644 index 4fb16cb..0000000 --- a/src/Game/display.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "Game.hpp" - -#include <cstdlib> -#include <cstdio> -#include <iostream> - - -void Game::displayBoard() { - for (int i = 0; i < boardHeight; i++) { - for (int j = 0; j < boardWidth; j++) - putchar(tileMap[i][j]); - putchar('\n'); - } -}
\ No newline at end of file diff --git a/src/Game/edit.cpp b/src/Game/edit.cpp deleted file mode 100644 index af89e65..0000000 --- a/src/Game/edit.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "Game.hpp" -#include "../Utils/Utils.hpp" - -#include <cstdlib> -#include <cstdio> -#include <iostream> -#include <string> - -int Game::editDiff(){ - Utils util; - - std::cout << "Now editing custom difficulty" << std::endl; - - std::cout << "Board width: "; - if(util.catchReturn(util.catchInputInt(Game::boardWidth)) != 0) return 1; - std::cout << Game::boardWidth; - - std::cout << "Board height: "; - if(util.catchReturn(util.catchInputInt(Game::boardHeight)) != 0) return 1; - - std::cout << "Mines: "; - if(util.catchReturn(util.catchInputInt(Game::mines)) != 0) return 1; - - return 0; -}
\ No newline at end of file diff --git a/src/Game/init.cpp b/src/Game/init.cpp deleted file mode 100644 index a572fbc..0000000 --- a/src/Game/init.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "Game.hpp" - -#include <cstdlib> -#include <cstdio> -#include <iostream> - -void Game::initDiff(int diff) { - switch (diff) { - case 0: - boardWidth = 9; - boardHeight = 9; - mines = 9; - break; - case 1: - boardWidth = 16; - boardHeight = 16; - mines = 12; - break; - case 2: - boardWidth = 30; - boardHeight = 16; - mines = 16; - break; - case 3: - std::cout << "Editing game parameters\n"; - break; - } -} - -void Game::initBoard() { - for (int i = 0; i < boardHeight; i++) - for (int j = 0; j < boardWidth; j++) - bombMap[i][j] = rand() % 2; - - for (int i = 0; i < boardHeight; i++) - for (int j = 0; j < boardWidth; j++) - tileMap[i][j] = 0; -}
\ No newline at end of file diff --git a/src/Utils/catch.cpp b/src/Utils.cpp index 37ebefe..37ebefe 100644 --- a/src/Utils/catch.cpp +++ b/src/Utils.cpp diff --git a/src/Utils/Utils.hpp b/src/Utils.hpp index e977db4..e977db4 100644 --- a/src/Utils/Utils.hpp +++ b/src/Utils.hpp |
