diff --git a/doc/class_diagramm_core.png b/doc/class_diagramm_core.png index bd54c31..8c68a83 100644 Binary files a/doc/class_diagramm_core.png and b/doc/class_diagramm_core.png differ diff --git a/doc/class_diagramm_pieces.png b/doc/class_diagramm_pieces.png index 636767f..e80cbec 100644 Binary files a/doc/class_diagramm_pieces.png and b/doc/class_diagramm_pieces.png differ diff --git a/src/Core/Menu.cpp b/src/Core/Menu.cpp index a4feba6..2be52e6 100644 --- a/src/Core/Menu.cpp +++ b/src/Core/Menu.cpp @@ -4,15 +4,19 @@ #include "Player.h" #include "Game.h" +#include + Menu::Menu() { + this->piecesList = std::make_shared(PiecesList()); + // default board size this->boardHeight = 20; this->boardWidth = 10; } Game Menu::startGame(Gamemode gamemode) const { - return Game(gamemode, this->playerControls, this->boardWidth, this->boardHeight, std::make_shared(this->piecesList)); + return Game(gamemode, this->playerControls, this->boardWidth, this->boardHeight, this->piecesList); } bool Menu::setBoardWidth(int width) { @@ -42,5 +46,5 @@ Player& Menu::getPlayerControls() { } PiecesList& Menu::getPiecesList() { - return this->piecesList; + return *this->piecesList; } diff --git a/src/Core/Menu.h b/src/Core/Menu.h index 5268a7e..27f98ef 100644 --- a/src/Core/Menu.h +++ b/src/Core/Menu.h @@ -12,10 +12,10 @@ static const int FRAMES_PER_SECOND = 60; // the number of frames per second, all */ class Menu { private: - PiecesList piecesList; // the list of pieces in the game - Player playerControls; // the controls of the player - int boardWidth; // the width of the board for the next game - int boardHeight; // the height of the board for the next game + std::shared_ptr piecesList; // the list of pieces in the game + Player playerControls; // the controls of the player + int boardWidth; // the width of the board for the next game + int boardHeight; // the height of the board for the next game public: /** diff --git a/src/TextUI/TextApp.cpp b/src/TextUI/TextApp.cpp index bf6bcef..ce3c5eb 100644 --- a/src/TextUI/TextApp.cpp +++ b/src/TextUI/TextApp.cpp @@ -195,11 +195,13 @@ void TextApp::startGame() const { } } - std::cout << "\n\n\n"; - if (paused) { - std::cout << "--<[PAUSED]>--" << std::endl; + if (!quit) { + std::cout << "\n\n\n"; + if (paused) { + std::cout << "--<[PAUSED]>--" << std::endl; + } + this->printGame(game); } - this->printGame(game); if (game.hasLost()) { quit = true; diff --git a/src/TextUI/main.cpp b/src/TextUI/main.cpp index 5e5f631..9042c02 100644 --- a/src/TextUI/main.cpp +++ b/src/TextUI/main.cpp @@ -18,6 +18,9 @@ void readStatsFromFilesForAllSizes(int amount); int main(int argc, char** argv) { std::srand(std::time(NULL)); + // dev: generate files if it hasn't been done before, UI will NOT generate the files + //generateFilesForAllSizes(10); + TextApp UI; UI.run();