aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/Game.cpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-02-28 19:13:27 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-02-28 19:13:27 +0100
commit4c959fe12ed2f26cbfac9646d3488cb00676fb31 (patch)
tree551c288b6041ad7e60bcfab0ebffed1e6f300c62 /src/game_tab/Game.cpp
parenta8c59c41bc103f0336d9982369be5dd85ac68111 (diff)
Improve Game and HalfMoves memory management
Diffstat (limited to 'src/game_tab/Game.cpp')
-rw-r--r--src/game_tab/Game.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/game_tab/Game.cpp b/src/game_tab/Game.cpp
index e26efd7..8b52ca6 100644
--- a/src/game_tab/Game.cpp
+++ b/src/game_tab/Game.cpp
@@ -15,13 +15,19 @@ Game::Game(std::string fen) : current(NULL), moves(NULL), result("*") {
board = chessarbiter::FENParser::Parse(fen).board;
}
-Game::Game(HalfMove *m, std::string initial_fen): result("*") {
+Game::Game(HalfMove *m, std::string initial_fen) : result("*") {
moves = m;
current = m;
this->initial_fen = initial_fen;
board = chessarbiter::FENParser::Parse(initial_fen).board;
}
+Game::~Game() {
+ if (moves != NULL) {
+ delete moves;
+ }
+}
+
std::string Game::GetBoard() { return (board); }
std::string Game::GetTag(std::string tagname) { return (tags[tagname]); }