From 637b9d54be4601ff4120ca56aab2f28973d88f96 Mon Sep 17 00:00:00 2001 From: dawidg81 Date: Sun, 1 Feb 2026 12:33:31 +0100 Subject: Updated Game.cpp --- src/Game.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Game.cpp b/src/Game.cpp index ad29029..7f925fa 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -61,10 +61,28 @@ int Game::editDiff(){ std::cout << "Now editing custom difficulty" << std::endl; std::cout << "Board width: "; + std::cin >> boardWidth; + + if (boardWidth > MAX_W) { + std::cout << "Board width can't be more than " << MAX_W << " tiles." << std::endl; + return 1; + } std::cout << "Board height: "; + std::cin >> boardHeight; + + if (boardHeight > MAX_H) { + std::cout << "Board height can't be more than " << MAX_H << " tiles." << std::endl; + return 1; + } std::cout << "Mines: "; + std::cin >> mines; + + if (mines > 8 || mines > (boardWidth * boardHeight)) { + std::cout << "There can't be more than " << mines << "mines." << std::endl; + return 1; + } return 0; } -- cgit v1.2.3