From b492bfb0d4cafe69edf69f196911f1b0e64c43df Mon Sep 17 00:00:00 2001 From: dawidg81 Date: Mon, 26 Jan 2026 17:15:33 +0100 Subject: added utilities; recovered custom difficulty editing --- src/game/Game.hpp | 2 +- src/game/edit.cpp | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src/game') diff --git a/src/game/Game.hpp b/src/game/Game.hpp index 7518a84..767ab94 100644 --- a/src/game/Game.hpp +++ b/src/game/Game.hpp @@ -15,7 +15,7 @@ private: int mines; public: - void editDiff(); + int editDiff(); void initDiff(int diff); void initBoard(); void displayBoard(); diff --git a/src/game/edit.cpp b/src/game/edit.cpp index 53605ca..b2d2542 100644 --- a/src/game/edit.cpp +++ b/src/game/edit.cpp @@ -1,9 +1,27 @@ #include "Game.hpp" +#include "../utils/Utils.hpp" #include #include #include +#include + +int Game::editDiff(){ + Utils util; -void Game::editDiff(){ std::cout << "Now editing custom difficulty" << std::endl; + + std::cout << "Board width: "; + util.catchInputInt(Game::boardWidth); + if(util.catchReturn(util.catchInputInt(Game::boardWidth)) != 0) return 1; + + std::cout << "Board height: "; + util.catchInputInt(Game::boardHeight); + if(util.catchReturn(util.catchInputInt(Game::boardHeight)) != 0) return 1; + + std::cout << "Mines: "; + util.catchInputInt(Game::mines); + if(util.catchReturn(util.catchInputInt(Game::mines)) != 0) return 1; + + return 0; } \ No newline at end of file -- cgit v1.2.3